Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are spaces allowed after a backslash to continue a line (in C/C++) [duplicate]

Tags:

c++

c

macros

When using \ to continue a line, are spaces allowed after the backslash (on the same line)?

like image 487
Bob Avatar asked Jun 30 '16 16:06

Bob


Video Answer


1 Answers

A new-line character should go immediately after a backslash. The C++ standard (N4140) states:

2.2 Phases of translation
....

Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice.

(The C standard has the same rules in 5.1.1.2 Translation phases.)

like image 135
AlexD Avatar answered Nov 14 '22 22:11

AlexD