在 C 中调用函数时 \ 是什么意思?
What does \ mean while calling a function in C?
我在看一些代码,看到它在调用函数时使用 \ 来分隔行,这意味着什么吗?还是只是为了提高可读性?
function(\
lets_say_this_a_long_attribute, \
and_this_is_another_attribute_with_a_long_name_or_operations, \
attribute);
来自 C 标准 (5.1.1.2 Translation phases)
- 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.
例如这些物理线路
i\
n\
t\
x;
形成逻辑线
int x;
这是一个演示程序。
#include <stdio.h>
int main(void)
{
i\
n\
t\
x = 10;
p\
r\
i\
n\
t\
f
( "%d\n",
x );
return 0;
}
它的输出是
10
此技术用于编写宏,例如#define。
我在看一些代码,看到它在调用函数时使用 \ 来分隔行,这意味着什么吗?还是只是为了提高可读性?
function(\
lets_say_this_a_long_attribute, \
and_this_is_another_attribute_with_a_long_name_or_operations, \
attribute);
来自 C 标准 (5.1.1.2 Translation phases)
- 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.
例如这些物理线路
i\
n\
t\
x;
形成逻辑线
int x;
这是一个演示程序。
#include <stdio.h>
int main(void)
{
i\
n\
t\
x = 10;
p\
r\
i\
n\
t\
f
( "%d\n",
x );
return 0;
}
它的输出是
10
此技术用于编写宏,例如#define。