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:51:48 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Oct 27, 2012 at 04:58:09PM -0700, Harlan Stenn wrote:
> Adrian Bunk writes:
> > On Sat, Oct 27, 2012 at 02:05:01PM -0700, Harlan Stenn wrote:
> > > Paul Eggert writes:
> > > > 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.
> > > 
> > > This is good news/bad news, IMO.
> > > 
> > > It means that if I want to do compliance testing to make sure a package
> > > builds under a variety of compilers I have to do work "outside" of
> > > autoconf to make that happen.
> > 
> > I don't understand the problem you are trying to describe.
> 
> If I have software that is supposed to be buildable by C89 or later,
> then this software must be built using a variety of (versions of)
> compilers to make sure  this is true.

Real "buildable by C89 or later" is rarely used, since due to lack of 
long long you have no guaranteed 64bit integer type in C89.

> A developer using a more recent C
> compiler may unknowlingly add code that requires a newer compiler.

This problem can anyway not be completely solved that way, since a more 
recent version of a compiler might e.g. support more C99 features in 
it's C99 mode than older versions in C99 mode.

> > > It also means that the installed STDC may be too old for what I want I
> > > have to do other checks to make sure the installed STDC is sufficient.
> > > 
> > > It might be good to be able to say "at least C89".
> > 
> > Current autoconf git gives you "as high as possible".
> 
> Sure, and as I've been saying, that's not always what  somebody wants.
> 
> Separate "mechanism" from "policy".
> 
> You seem to be saying your policy will work for everybody...

There already were lengthy discussions on that here.

It might become tricky to handle cases like [1], where some random macro
(which you might be using indirectly) rightfully demands that the C89 
mode of the compiler is not enough for it.

Are all your use cases solved with a --disable-compiler-mode-setting
flag to configure?

> > "at least C89" can anyway be assumed today.
> 
> Probably...
> 
> > How to test for what you need (also allowing you to abort configure if 
> > something you need is not supported) is a separate issue.
> 
> There is a difference between ignoring a problem and making a problem
> you don't have harder to solve for those folks who *do* have to think
> about it.

No, these simply are separate issues.

As an example, no version of gcc so far completely supports C99 [2],
and even less does gcc completely support C11.

autoconf can set the compiler into C99 or C11 mode for you.

But that doesn't answer the question whether the compiler supports all 
C99 or C11 features you need, since that depends on what features you
use in your code.

> H

cu
Adrian

[1] 
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_c99_inline.m4
[2] http://gcc.gnu.org/c99status.html

-- 

       "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]