Subject: Re: [boost] Official warnings policy?
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-11-05 11:09:11
Ian McCulloch wrote:
> Steven Watanabe wrote:
>> Patrick Horgan wrote:
>>> Vladimir Prus wrote:
>>>> I would remove -pedantic, but otherwise, it's a very good idea.
>>>> Unfortunately, recent discussion left me with the impression that
>>>> few folks care.
>>> -pedantic issues all the warnings required by strict ISO C and ISO
>>> C++. They are in the standard for a reason, and I think it fair to
>>> expect system code that I build my code on to pass it. It's the
>>> same parts of boost that always generate warnings. Other parts are
>>> always free of warnings. Not rocket science to know that some are
>>> building better code.
>> Even the problems reported by -pedantic are not necessarily real
>> problems. For example, it's a huge pain to use long long with
>> -pedantic, even though all uses in boost should be protected by
> Sure, but you can turn off -pedantic warnings individually. I
> use -pedantic -Wall -Wno-long-long -Wno-unused-value a lot.
The problem is that everyone uses different flags for warnings. If there were an official boost policy about which warning flags are used with which compilers and compiling with warnings as errors for those warnings that are enabled that would allow people who work in companies with strict policies about warnings to ask for the flags they use to enforce the policy to be changed to be compatible with those supported by boost. If someone comes to their boss and says "I want to use boost, but we need to add -Wno-long-long to our build" he at least has a chance of getting boost into his project. No one reasonable cranks warning levels to 11 and then doesn't turn off individual warnings with flags because some warnings are frankly stupid and a waste of everyone's time. In particular there are warnings in MSVC that cannot be "fixed" without hurting the quality of the code. When calling the default constructor syntax for built in data types in the initializer list of a class constructor MSVC warns that it has changed behavior and now initialized those values to zero instead of leaving them uninitialized. If the member is a c-style array the only way to fix the warning is to remove the member from the initializer list or suppress it with a pragma. Everyone can thank microsoft once for doing the right thing initializing data, but doesn't need to thank them dozens of times every time they compile their code, so this warning can and should be globally disabled with a flag. Next time MSVC improves their standard compliance in some small way we can hope they put it in the release notes and not the warnings the compiler generates. If we are going to have an official boost policy for warnings we need a list of flags for each major compiler that we can all agree to.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk