Page 81 - C-Language
P. 81
#if 0 /* Starts the "comment", anything from here on is removed by preprocessor */
/* A large amount of code with multi-line comments */
int foo()
{
/* lots of code */
...
/* ... some comment describing the if statement ... */
if (someTest) {
/* some more comments */
return 1;
}
return 0;
}
#endif /* 0 */
/* code from here on is "uncommented" (included in compiled executable) */
...
Possible pitfall due to trigraphs
C99
While writing // delimited comments, it is possible to make a typographical error that affects their
expected operation. If one types:
int x = 20; // Why did I do this??/
The / at the end was a typo but now will get interpreted into \. This is because the ??/ forms a
trigraph.
The ??/ trigraph is actually a longhand notation for \, which is the line continuation symbol. This
means that the compiler thinks the next line is a continuation of the current line, that is, a
continuation of the comment, which may not be what is intended.
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;
Read Comments online: https://riptutorial.com/c/topic/10670/comments
https://riptutorial.com/ 57

