Code writing specification when it needs to be broken to the next line

How's coding text specification when it needs to be broken to the next line by adding \ i.e. how is it if there're some \ characters in the will-be-broken long code line itself, how compiler way of parse ?
If the very last character in a line (right before the line-break) is a \, then the C/C++ pre-processor discards that \ character as well as the following line-break, i.e. it will treat the current line and the next line as one "contiguous" line; any other appearance of the \ characters simply remains as-is.
Last edited on
The backslash starts a so called escape sequence. See this:

https://en.cppreference.com/w/cpp/language/escape

For a list of possible escape sequences
... except when the \ is the last char on a line when it is interpreted as a line continuation char.

There is a change coming in C++23 (which seems to only impact VS) re trimming white-space chars before line splicing:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf
heh, they linked the tame clang bug report, but not gcc's https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8270 with its endless duplicates and colorful language "perversely out of sympathy"
Topic archived. No new replies allowed.