关于 ansi C 的好奇三字母序列

发布于 2024-12-04 08:47:56 字数 213 浏览 4 评论 0原文

使用某些字符的三字母序列成为ansi C中的其他字符的最初原因是什么,例如

??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)

#define arraycheck(a, b) a[b] || b[a]

What was is it the original reason to use trigraph sequence of some chars to become other chars in ansi C like:

??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)

becomes

#define arraycheck(a, b) a[b] || b[a]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把回忆走一遍 2024-12-11 08:47:56

简短的回答:不包括此类图表的键盘/字符编码。

来自维基百科:

C 编程语言的基本字符集是 ASCII 字符集的超集,其中包括 ISO 646 不变字符集之外的九个字符。当使用的键盘不支持这九个字符中的任何一个时,这可能会给编写源代码带来问题。 ANSI C 委员会发明了三字母作为使用支持任何版本的 ISO 646 字符集的键盘输入源代码的一种方式。

http://en.wikipedia.org/wiki/Digraphs_and_trigraphs

Short answer: keyboards/character encodings that didn't include such graphs.

From wikipedia:

The basic character set of the C programming language is a superset of the ASCII character set that includes nine characters which lie outside the ISO 646 invariant character set. This can pose a problem for writing source code when the keyboard being used does not support any of these nine characters. The ANSI C committee invented trigraphs as a way of entering source code using keyboards that support any version of the ISO 646 character set.

http://en.wikipedia.org/wiki/Digraphs_and_trigraphs

寄意 2024-12-11 08:47:56

一些旧键盘上没有特定的字符,因此该语言通过让您使用三字母来解决它。

Some old keyboards didn't have specific characters on them, so the language worked around it by letting you use trigraphs instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文