This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: odd behavior


[Please don't top-post.  Thanks.]

> > #if 0
> > const char* s = ";
> > #endif
> > int main() { }

> Ah-ha! You're right. Now I see that this warning is issued by
> preprocessor, not by compiler. Now that I think about it, it seems
> logical. Preprocessor has to tokenize input to perform substitutions
> and such, so even if code isn't meant for compiler, it must follow
> some rules - ifdefined parts of code are not comments. Is that right?

C11 6.4/3 says the lonely quote is undefined behaviour.  Your program
might or might not work (the same) with a different (version of the)
compiler.  So a warning is good.


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]