Subject: Re: [boost] [Wiki] Changes in information about gcc warnings.
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2011-01-18 15:59:42
On 01/18/2011 06:08 AM, Stewart, Robert wrote:
> ... elision by patrick ...
> -pedantic is a pain if you use, for example, #ident. So far as I know, there's no way to reduce the resulting noise.
That's true. Unfortunately there's no individual -W option for
complaining about #ident, so you can't turn off the warning. If you're
using #ident, which is a gcc extension, then you're clearly making a
choice to use that compiler and that extension. In that case I
wouldn't use -pedantic. Even something like using -std=gnu++0x won't
get rid of it. It's a perfectly valid choice, but conflicts with a goal
to be portable across many compilers.
boost code aims to be very adherent to standards, to be very portable,
and to avoid any particular compiler's extensions when possible. (Of
course it's not always possible nor efficient.) There's no code in
boost that uses #ident. The use of -pedantic for boost code keeps
extensions from creeping in unobserved, and helps to let you know if
you've strayed from a particular version of a standard. It helps you to
be portable. In this case I think it's a good thing. Of course if
you're doing this it would be most helpful to add a -std=xxxxx option to
the gcc invocation so you know what version of the standard you're
trying to adhere to. -pedantic will complain about different things
depending on the -std=xxxxx option.
Do you know what the default is for the version of gcc you're using
(currently c++98)? As an example, there's a lot of usage of long long
in boost, which is not in c++98 and will give warnings in the absence of
-std=c++0x. Using -pedantic in boost without -std=c++0x yields a lot of
warnings because boost tends to be at the forward edge of use of
available parts of the language.
I also advocate -Wextra.