C++ single line comments followed by \ transforms in multiline comment

C++ standard, 2.2 – phases of translation. Phase 2 includes

Each instance of a backslash character (\) immediately followed by a new-line character is deleted,
splicing physical source lines to form logical source lines.

and Phase 3 includes

Each comment is replaced by one space character

So the backslash at the end of the line is recognised before comments.

Equivalent phases 2 and 3 for C can be found in C standard (5.1.1.2 Translation phases in my draft).

Leave a Comment