autoconf
[Top][All Lists]
Advanced

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

Re: Selecting a C++ standard


From: Roger Leigh
Subject: Re: Selecting a C++ standard
Date: Sun, 28 Oct 2012 11:07:23 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Oct 28, 2012 at 03:00:01AM +0300, Adrian Bunk wrote:
> 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.

Yes, but we aren't really talking about testing strict standards
conformance here.  We just want the compiler put in a *specific*
mode.  If I want C11, I certainly won't find the C99 or C89
fallbacks useful at all.  I want it to fail there and then.

If I need specific feature tests for that mode, I'll then
proceed to do them.  All I want here is that it identify the
correct -std= option (or equivalent for other compilers).

> > 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.

There isn't any downside I'm aware of.  But that's somewhat
different than saying, "I need at least this version of the
standard".  If I say I want C99, then C11 or C99 are both
acceptable results.  But C89 is totally useless.

As described in this thread, the AC_PROG_CC fallbacks are
useless (for me).  If I want C11, it can't guarantee it.  If I
want C99, it can't guarantee it.  I need to be able to specify
the minimum standard conformance required, and have autoconf
try to satisfy that.  If it can't do that, then what exactly
is the point of it?

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

If it does, it's a compiler bug, since both the C and C++ standards
committees went to great lengths to ensure complete backward
compatiblity.  It's not, IMO, something that autoconf need be
concerned with when implementing this.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



reply via email to

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