Trigraphs
You're using the good ol' trick of trigraphs.
// Why won't this line work???/
| |
\ /
|
~trigraph~
The ??/
trigraph is in turn converted to \
which basically concatenates the current line with the next line and thus your code becomes more or less like this:
// Why won't this line work? foo(x);
A fine trick indeed.
Quoting from the C++11 standard:
§2.2.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. ...
§2.4.1:
Table 1 - Trigraph sequences
...
==========================
| Trigraph | Replacement |
==========================
| ... |
==========================
| ??/ | \ |
==========================
Fortunately, GCC seems to detect this kind of trickery, emitting a warning (just set -Wall
):
main.cpp:13:32: warning: trigraph ??/ converted to \ [-Wtrigraphs]
// Why won't this line work???/
^
main.cpp:13:4: warning: multi-line comment [-Wcomment]
// Why won't this line work???/
^
Related references:
meaning of `???-` in C++ code
What is this smiley-with-beard expression: "<:]{%>"?
What does the C ??!??! operator do?
And all other similar questions out there. ??)
PS: That's a smiley.