From: jrs@world.std.com (Rick Sladkey) Subject: Re: Possible gotcha in gcc Date: Thu, 15 Apr 1993 02:20:55 GMT
>>>>> On Wed, 14 Apr 1993 13:01:10 GMT,
>>>>> davidsen@ariel.crd.GE.COM (william E Davidsen) said:
bill> I noted an interesting behavior in gcc last night, it doesn't
bill> ignore stuff which is #ifdef'd out! I got a program to port to
bill> Linux, and I had some text included which I found valuable.
bill> Having learned long ago that putting /*...*/ around arbitrary
bill> stuff might be a problem due to */ in the text, I put #if 0 ...
bill> #endif around it instead. A gcc generated error messages about
bill> the text it should have been ignoring!
I noticed this too. An excerpt from the GCC manual:
+-----
| * GNU CC will flag unterminated character constants inside of
| preprocessor conditionals that fail. Some programs have English
| comments enclosed in conditionals that are guaranteed to fail; if
| these comments contain apostrophes, GNU CC will probably report
| an error. For example, this code would produce an error:
|
| #if 0
| You can't expect this to work.
| #endif
|
| The best solution to such a problem is to put the text into an
| actual C comment delimited by `/*...*/'. However, `-traditional'
| suppresses these error messages.
+-----