想象一下我们编写这段代码:
printf ("testtest"
"titiritest%s",
" test");
这是否符合 ISO/IEC:9899 §5.1.1.2 — 2
是 3 个不同的逻辑源代码行还是单个逻辑源代码行?
这是吗
2. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.
关于形成逻辑源代码行提到的唯一规则?
关于
5.2.4.1 Translation limits
[...]
— 4095 characters in a logical source line
这意味着每个翻译单元不应变得更大为 4095 个字符,只要我们不在换行符之前使用 \
即可。我很确定,这不是他们想要说的。
那么我缺少查找的定义部分在哪里?
最佳答案
这是三个逻辑源代码行。
逻辑源代码行非常重要,因为宏定义必须适合一个逻辑源代码行;我现在无法想到多于一行的逻辑源代码行的任何其他用途。要构造大型字符串文字,您可以使用由多个物理源代码行组成的逻辑源代码行(我个人认为这非常丑陋),或者依赖于引用的字符串将被连接这一事实,这更具可读性和可维护性。
关于c - 关于c99,逻辑源行的定义是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24363299/