autoconf
[Top][All Lists]
Advanced

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

Re: Selecting a C++ standard


From: Adrian Bunk
Subject: Re: Selecting a C++ standard
Date: Sun, 28 Oct 2012 03:00:01 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Oct 27, 2012 at 10:47:50PM +0100, Roger Leigh wrote:
> On Sat, Oct 27, 2012 at 01:55:58PM -0700, Paul Eggert wrote:
> > On 10/27/2012 01:38 PM, Roger Leigh wrote:
> > > Is anyone working on such a thing?
> > 
> > Not that I know of.
> > 
> > For C, we're deprecating the "I want version X"
> > macros in favor of just AC_PROG_CC_STDC, which says
> > "I want the latest version".  You might want to do
> > that for C++ to, as it's more the Autoconf Way.
> 
> I agree that having AC_PROG_CC_STDC select the latest version is a
> sensible default.
> 
> However, what do I do if I am making use of C99 features?  It
> will probably fail if I'm using a feature that's not in a
> traditional or C89 compiler.  But what if it's more subtle, if I'm
> relying on a behaviour change in C99, and it compiles (but
> incorrectly with C89)?  In this case, I would much rather tell
> autoconf that I require a C99 compiler, and have it fail with
> a useful error message during configure, rather than fail
> during compilation or runtime with some unpredicable/obscure
> error.

Testing for features is a problem separate from compiler mode setting.

Just like AC_PROG_CC_C99 didn't ensure a C99 compiler, you always have 
to check ac_cv_prog_cc_c99.

> Maybe have an optional argument to AC_PROG_CC_STDC to select
> the standard e.g.
>   AC_PROG_CC_STDC([C99])
> ?

Latest discussion result was that there is no downside of setting the 
compiler to the highest mode possible.

And as said above, feature testing is a separate issue.

> I originally wrote AC_PROC_CC_C99 because it was several years
> since GCC supported C99, but there was no portable way to use
> C99 features with projects using autoconf unless you added
> horrible hacks.  We still have this situation for C++, and it
> would be nice to solve it in a similar way to C.  I'm happy to
> go with the new approach of a single macro, but I would be
> interested to understand how the issues I outlined above square
> with this.

The main worry would actually be whether a compiler in C++11 mode might 
reject any existing C++03 code.

> Regards,
> Roger

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed




reply via email to

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