Possible pitfall due to trigraphs

suggest change

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;

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents