This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: odd behavior
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: JÄdrzej Dudkiewicz <jedrzej dot dudkiewicz at gmail dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, Michael Williamson <michael dot h dot williamson at gmail dot com>, gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 29 Aug 2014 07:12:01 -0500
- Subject: Re: odd behavior
- Authentication-results: sourceware.org; auth=none
- References: <CAKZygbd3AV0D9p+Btp_M52WG0GqOFPBdX=j496JiDjU+XZgy5Q at mail dot gmail dot com> <CABJqhQNJ9ditprsb4cAdPfADOxwwhg2XCw3oeHvD1B=BNjDS7A at mail dot gmail dot com> <CAH6eHdRqMSc1rKD-DyaNVmZcHebCGnHDvKqRyKJ9Dh0T--KeWQ at mail dot gmail dot com> <CABJqhQOOpFe6b4WbkLCBncazX4KXidYV-TU8n+uP6HWAO+rARQ at mail dot gmail dot com>
[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