三卦造成的可能陷阱

Version >= C99

在编写//分隔注释时,可能会产生影响其预期操作的打印错误。如果有一种类型:

int x = 20;  // Why did I do this??/

最后的/是一个错字,但现在将被解释为\。这是因为 ??/形成了一个字形。

??/三字母实际上是\的简写符号,它是行连续符号。这意味着编译器认为下一行是当前行的延续,即注释的延续,这可能不是预期的。

int foo = 20; // Start at 20 ??/
int bar = 0;

// The following will cause a compilation error (undeclared variable 'bar')
// because 'int bar = 0;' is part of the comment on the preceding line
bar += foo;