autoconf
[Top][All Lists]
Advanced

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

Re: AC_PROG_CC_C99


From: Steven G. Johnson
Subject: Re: AC_PROG_CC_C99
Date: Fri, 03 Dec 2004 18:26:02 -0500
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

Paul Eggert wrote:
Can you please also check for the following features?
  variable declarations in for loops
  last member of a struct may be an incomplete array type
  varargs macros
  named initialization of structs
  variable length arrays
  long long
These are all features that C99-ish programs are likely to want.

I'm not sure this is a good idea, because:

Paul Eggert also wrote:
> Part of the motivation for keeping that stuff hidden is that we don't
> want people to switch based on whether our macro "thinks" the compiler
> is "C99" or "C89" or "not".  They should switch based on the
> particular feature that they need.

As you yourself point out, the purpose of the AC_PROG_CC_C99 macro is to discover compiler flags that put the compiler in a C99-ish mode, *not* to guarantee that the compiler completely conforms to the C++ standard.

For example, suppose I want C99 mode because I want to use complex arithmetic...and the compiler/libc mostly supports this, but variable-length arrays are somewhat broken. I want AC_PROG_CC_C99 to pass and put the compiler in C99 mode, and then I can check for complex-arithmetic support. With your suggestion, AC_PROG_CC_C99 might fail because of features I don't need.

AC_PROG_CC_C99 should, ideally, test the minimal set of features that pass in C99 mode and fail in non-C99 mode. In practice, it should test slightly more than the minimum in order to have a better chance of working on not-yet-tested compilers. It should certainly be very, very far from comprehensive, however.

Steven





reply via email to

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