This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor bug(?)
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 7 Nov 2002 16:30:00 -0800
- Subject: Re: preprocessor bug(?)
- References: <C0502FB6-F2AF-11D6-B269-000393D76DAA@apple.com>
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