Re: odd behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux