Boost logo

Boost :

Subject: Re: [boost] [test] Any dependency on Boost.Test requires C++11 ?
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2013-03-17 06:56:51


> At present any test in Boost.Math that depends on
> Boost.Test fails for GCC prior to 4.5 because the
> build script for Boost.Test has:

> <toolset>gcc:<cxxflags>-std=gnu++0x

> Is this really required?
> It looks wrong headed to me:

<snip>

> Can this be safely removed?
> Many thanks, John.

These command line switches are a nightmare,
but quite useful.

I took the time to summarize my own personal guidelines
pertaining to GCC C++ language specification in
relation to Boost. If anyone would like to extend
and/or correct these guidelines for Boost and
publish them on the net, it may decrease mixups
in this confusing matter.

Please don't flame me if I got the guidelines wrong.
Rather correct them instead.

Sincerely, Chris
--------------------------------------------------------------------------

Guidelines on:
Selecting the C++ language specification with GCC

GCC supports finely granulated selection of
the underlying C++ language specification
With command line options.

The command line option -std=c++98 selects
language conformance with ISO/IEC 14882:1998,
also known as C++98.

The command line option -std=c++03 selects
language conformance with ISO/IEC 14882:2003,
also known as C++03.

The command line option -std=c++11 selects
language conformance with ISO/IEC 14882:2011,
also known as C++11.

In general, Boost libraries should be compatible
with C++03 and use -std=c++03 accordingly.

Important: Please avoid using -std=c++11,
-std=gnu++11, and -std=gnu++0x. These command line
arguments activate GCC's experimental support
for C++11. There is not yet a consensus on using
C++11 in Boost libraries off-the-rack.

GCC also has the similar language options
-std=gnu++98, -std=gnu++03, -std=gnu++11,
and -std=gnu++0x.
These command line options activate certain
GNU-specific language extensions. Please avoid
using them because their use can lead to
non-portability issues.

The GCC command line option -std=c++0x was
an interim solution used for preliminary
support support for C++11 features before these
were published by ISO. As of GCC 4.7, the command
line option -std=c++0x has been replaced with
-std=c++11. If possible, preferentially use
-std=C++11 instead of -std=c++0x when testing
for C++11 compatibility. This rational for this
is that -std=c++0x can easily be confused with,
for example, -std=c++03.

Do note, however, that Boost libraries should
not yet rely on C++11 via the -std=c++11 switch
for their build and/or usage.

In general, then, please use -std=c++03.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk