At 10:48 AM -0800 3/8/03, Marcel Moolenaar wrote:
On Sat, Mar 08, 2003 at 12:28:13PM -0500, Garrett Wollman wrote:

 > `#if __GNUC__' wouldn't help matters; every preprocessor has to
 > read and interpret every preprocessor directive (so that `#else'
 > and `#endif' can be recognized).

I don't think preprocessors should interpret directives when they
are dead (ie part of an #if block or #else block that is not to
be compiled).

I tried to use this once, on a cross-platform program I wrote. I can tell you that some compilers will choke on a #warning, even if it is inside a #if/#endif. And other compilers will choke on #warn, even if *it* is in a #if/#endif. (note: some compilers which do not recognize #warning will support #warn for the same thing).

By adding that #warning, you are going to have a compile-time error
on some compilers, whether or not you want it.  Hiding it inside of
an #if/#endif will help for some compilers, but not on all of them.

--
Garance Alistair Drosehn            =   [EMAIL PROTECTED]
Senior Systems Programmer           or  [EMAIL PROTECTED]
Rensselaer Polytechnic Institute    or  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to