|
Boost : |
Subject: Re: [boost] Towards a Warning free code policy proposal
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-08-30 01:20:07
Hello All,
How to deal with warning?
- If code produces warning disable it?
You will end with numerous ifdefs for each compiler:
GCC, Intel, MSVC, SunStudio and much more.
You would even find yourself subdividing each of the following
cases for compiler versions where each one of them produce
some kind of warning and finally you will disable some important
warning accidentally.
- If the code is produces warning, fix it. And you end with
100 stupid cases where each compiler thinks it is important,
* gcc warns on polymorphic class without virtual destructor
even if sometimes you don't need it.
* MSVC calls every single standard C library function dangerous
like fopen, localtime and so-on.
* Intel produces multiple lines of usless remarks on temporary
objects.
- What warning level to use under GCC -Wall? -Wextra? -Wpedantic?
and under MSVC /w2? /w3? or /w4?
I have never seen a big project that compiles cleanly with /w4 under
MSVC.
IMHO: let library developer decide what to disable and what policy
he should use. Developer that respects himself would code the
way the code compiles with severe warning level.
My $0.02
Artyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk