Re: #include - Bug or weird part of the C[++] spec?
Re: #include - Bug or weird part of the C[++] spec?
- Subject: Re: #include - Bug or weird part of the C[++] spec?
- From: Matt Gough <email@hidden>
- Date: Tue, 1 Jul 2008 09:58:49 +0200
Actually, it does seem like a bug:
http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html#Include-Syntax
"It is an error if there is anything (other than comments) on the line
after the file name."
Matt
On 1 Jul 2008, at 9:46am, email@hidden wrote:
I noticed recently, when viewing a source file, that all the text
was being syntax colored as if it were part of a string literal.
However the code compiled and ran correctly.
On further investigation, it turned out that there was an extra " at
the end of a #include. i.e:
#include "MyHeader.h""
Further investigation showed that pretty much any text can appear
after the included file without causing a compile error or warning
(with all warnings ON).
i.e all these full lines are perfectly 'valid':
#include "MyHeader.h"1234 * 67
#include <stdio.h>>>>
#include <stdio.h>, <math.h> But it won't really include math.h
#include "MyHeader.h" */ Does not need an opening comment (But will
close one if it existed!)
So is this really a bug, or some part of the spec that I have
happily ignored until now.
If it is in the spec, then there should be some warning for it I
think.
Matt Gough
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden