C++ single line comments followed by \ transforms in multiline comment
Where is it documented in the C++ Standard the feature that if a line is commented using //some comment\
style (at the end of the line puts \
) the comment is transformed to multiline?
Tested with g++ 4.8 and VS 2012
//some interesting stuff\
another interesting stuff\
etc
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).
A \
followed by a new line is eliminated very early in the
translation process, before the compiler starts looking for
comments and the end of comments, see §2.2, Phases of
translation.