[Top][All Lists]

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

Re: Tru64 C V6 and _AC_PROG_CC_STDC

From: Norman Gray
Subject: Re: Tru64 C V6 and _AC_PROG_CC_STDC
Date: Fri, 18 Feb 2005 15:35:03 +0000


On 2005 Feb 11 , at 18.23, Paul Eggert wrote:

Norman Gray <address@hidden> writes:

Having __STDC__ equal to 0 violates the standard, thus this test is
giving the wrong result.  I've no idea what these `useful extensions'
are, and if I did, I'd certainly be sure to avoid them,

Some of these "useful extensions" are <stdio.h> functions like fileno,
which are required by POSIX.
However, as a practical matter, I've found that it's more hassle to
disable functions like fileno than it is to enable them.

That's wise.

Myself, I like --std-with-bondage-and-discipline flags, as they keep me honest. I feel they're more useful with C++ than with C, because there are more ways to stuff up with C++; and the fact that this is so I feel is one of the arguments against C++ as a generally useful language.

It might be worth a footnote in the AC_PROG_CC documentation, though, saying that `ANSI C' actually means `ANSI/ISO C without the surprising bits', and...

That being said, it might be reasonable to define a new Autoconf macro
AC_PROG_CC_STDC_PEDANTIC, or something like that, which tests for 100%
conformance to the C Standard in matters like this.

...gets you `ISO C, and we really mean it'.

The following patch to autoconf 2.59's lib/autoconf/c.m4 might be a start.

> # --------------------------------
> # As with AC_PROG_CC, except that the compiler is checked for strict
> # compliance with the ISO C standard.
> m4_define([AC_PROG_CC_STRICT],
> [m4_define([_AC_PROG_CC_STRICT_FLAG], [yes])
> AC_PROG_CC($1)
> m4_undefine([_AC_PROG_CC_STRICT_FLAG])
> #
> # If the macro _AC_PROG_CC_STRICT_FLAG is set to "yes", then check
> # for strict compliance with the ISO C standard.
> ]m4_if(_AC_PROG_CC_STRICT_FLAG, [yes], [dnl
> /* Check that the __STDC__ flag is defined to 1, not 0 */
> #if !__STDC__
>   choke me
> #endif
> ])[

...but only a start. The `strict' test in there is pretty primitive, and doesn't, for example, end up requiring gcc's -ansi or -pedantic flags. I'll leave for a separate discussion precisely what tests would be appropriate there, and which of those flags would be useful. Pace my remarks above, aiming for -ansi or equivalent would probably satisfy _me_ at least, since that ends up with the compiler behaving exactly as ISO-9899 or ISO-14882 says it should.

[And just by the way, an -iso flag would probably be less parochial than -ansi, unless we can have a -bsi, a -din, ... as well (hrumph). But that really is a separate issue!]

All the best,


Norman Gray  :  Physics & Astronomy, Glasgow University, UK
http://www.astro.gla.ac.uk/users/norman/  :  www.starlink.ac.uk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]