Subject: Re: Compiler warning levels and sccsid/rcsid
To: John F. Woods <jfw@jfwhome.funhouse.com>
From: J.T. Conklin <jconklin@netcom.com>
List: current-users
Date: 07/26/1995 11:54:02
> > If you have established you have gcc, you might as well use #ident, so
> > you don't have to "fool" the compiler at all...
> 
> An excellent suggestion, with just one flaw (I think):
> if I remember correctly, an ANSI compiler is entitled to choke on
> 
> #ifdef __GNUC__
> #ident fkfdlkkljfds
> #else
> ...
> #endif

I was about to disagree violently, but checked my copy of the standard
and couldn't find anything about unrecognized preprocessor directives.
Unless there is something hidden elsewhere (I was reading section 3.8
of the ANSI standard, the ISO section number is something else), I'd
have to agree that a ANSI compiler is entitled to balk at the above
construct (btw, the conditional should probably be something like
_HAVE_IDENT_DIRECTIVE).

However, this is unlikely to be a problem with modern compilers, they
are much more likely to throw a warning than to abort compilation for
something like this.  Compiler vendors are starting to understand that
it's ok to be liberal in what code their tools accept.

It is much more likely to screw up older pre-ansi compilers.  I
remember having to change all of the header files in our fax software
when the green hills m88k compiler balked on gcc's ``#pragma once''.

	--jtc