preprocessor bug(?)
Zack Weinberg
zack@codesourcery.com
Thu Nov 7 16:47:00 GMT 2002
On Thu, Nov 07, 2002 at 04:19:31PM -0800, Dale Johannesen wrote:
> One of our users just did this:
>
> // comment, space character follows the backslash:\
> main() {
> }
>
> gcc ignores the space character, which causes the comment to eat the
> next line.
> That's wrong, isn't it?
No, that's an intentional feature. From the manual:
3. Continued lines are merged into one long line.
A continued line is a line which ends with a backslash, `\'. The
backslash is removed and the following line is joined with the
current one. No space is inserted, so you may split a line
anywhere, even in the middle of a word. (It is generally more
readable to split lines only at white space.)
The trailing backslash on a continued line is commonly referred to
as a "backslash-newline".
If there is white space between a backslash and the end of a line,
that is still a continued line. However, as this is usually the
result of an editing mistake, and many compilers will not accept
it as a continued line, GCC will warn you about it.
Note especially the last paragraph. The user did get a warning,
didn't they?
zw
More information about the Gcc
mailing list