Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11979

Re: .h and .cpp

From yatremblay@bel1lin202.(none) (Yannick Tremblay)
Newsgroups comp.lang.c++
Subject Re: .h and .cpp
Date 2011-11-30 13:57 +0000
Organization A noiseless patient Spider
Message-ID <jb5cnf$vm1$1@dont-email.me> (permalink)
References <d30834a8-3bf4-49a4-b1eb-b66aef965475@i8g2000vbh.googlegroups.com> <slrnjd845a.1bk.grahn+nntp@frailea.sa.invalid> <jb54m3$fff$1@dont-email.me> <4ed626aa$0$3099$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


In article <4ed626aa$0$3099$7b1e8fa0@news.nbl.fi>,
Juha Nieminen  <nospam@thanks.invalid> wrote:
>Yannick Tremblay <yatremblay@bel1lin202.(none)> wrote:
>> -Wall -Wextra -pedantic -std=c++98 -Weffc++ -Wold-style-cast -Werror

Sorry, that was a <bad> joke, hence the smiley and the ""Real Men" use"

>  Turning a bunch of warning flags and then making them errors is an
>extremely dubious practice. Why? Because your program might compile
>with one version of a compiler, but not with another, solely because
>of the "-Werror" and without there being any real mistake in the program.
>(It might also not compile with a different compiler which supports the
>same flags. For example I think Intel's compiler supports most of the
>same flags as gcc.)
>
>  There's a relatively popular open source program whose main developers
>had the odd principle that any official build must be built with every
>single warning flag that they could find on the gcc documentation, plus
>-Werror. This had the adverse side-effect that completely inconsequential
>warnings, such as the compiler not being able to inline a function marked
>as "inline" (and, IIRC, even if it was unable to inline a *template*
>function) would cause the compilation to fail, even though there were no
>mistakes whatsoever in the code.
>
>  This completely idiotic principle caused that the program had to be,
>basically, fine-tuned for a specific version of gcc. A newer or older
>version of gcc with different optimization strategies could well decide
>not to inline one of those functions, causing the program not to compile.
>(And yes, this indeed was the case in practice.)
>
>  I don't know if they still have this idiotic principle.

So seriously:

I don't use -Werror however I use a policy that normally, all warnings
should be silenced.  Warnings oftens indicate real bugs, if the code
compile with hundreds of warning, peoples stop reading them.

-Werror is certainly unacceptable for code that is distributed in
 source format and expected to build in various environment.  However,
 in a closed source environment where that build environment changes
 either never or very rarely, this could be used as a way to enforce
 silencing warning.  I prefer a more diplomatic approach.  

I generally get on with -Wextra.  -Weffc++ is very hard to follow all
of the time in a large project.  In particular third party headers
tend to raise a lot of warnings.  I've never managed to get on with
-pedantic on a large project either.  It just tend to generate too
many warnings and warnings loose value due to noise. 

Yannick

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

.h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-28 09:20 -0800
  Re: .h and .cpp Leigh Johnston <leigh@i42.co.uk> - 2011-11-28 17:30 +0000
    Re: .h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-28 10:39 -0800
      Re: .h and .cpp Tobias Müller <troplin@bluewin.ch> - 2011-11-28 19:09 +0000
  Re: .h and .cpp ralph <nt_consulting64@yahoo.net> - 2011-11-28 12:37 -0600
    Re: .h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-28 10:48 -0800
      Re: .h and .cpp ralph <nt_consulting64@yahoo.net> - 2011-11-28 14:24 -0600
      Re: .h and .cpp yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-11-30 11:24 +0000
        Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-01 21:42 +0000
          Re: .h and .cpp Rui Maciel <rui.maciel@gmail.com> - 2011-12-02 02:03 +0000
            Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-02 20:59 +0000
  Re: .h and .cpp "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-28 19:45 +0100
    Re: .h and .cpp Leigh Johnston <leigh@i42.co.uk> - 2011-11-28 19:03 +0000
      Re: .h and .cpp "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-28 20:36 +0100
    Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-28 22:52 +0000
      Re: .h and .cpp yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-11-30 11:39 +0000
        Re: .h and .cpp Juha Nieminen <nospam@thanks.invalid> - 2011-11-30 12:50 +0000
          Re: .h and .cpp yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-11-30 13:57 +0000
            Re: .h and .cpp Juha Nieminen <nospam@thanks.invalid> - 2011-11-30 15:06 +0000
          Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-30 16:21 +0000
        Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-30 16:12 +0000
  Re: .h and .cpp Goran <goran.pusic@gmail.com> - 2011-11-28 10:58 -0800
    Re: .h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-28 13:30 -0800
      Re: .h and .cpp Tobias Müller <troplin@bluewin.ch> - 2011-11-29 06:44 +0000
      Re: .h and .cpp Goran <goran.pusic@gmail.com> - 2011-11-29 01:17 -0800
      Re: .h and .cpp Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-30 00:53 -0800
    Re: .h and .cpp "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-29 10:57 +0100
    Re: .h and .cpp yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-11-30 12:05 +0000
  Re: .h and .cpp Rui Maciel <rui.maciel@gmail.com> - 2011-11-28 20:07 +0000
  Re: .h and .cpp Geoff <geoff@invalid.invalid> - 2011-11-28 12:17 -0800
    Re: .h and .cpp Ian Collins <ian-news@hotmail.com> - 2011-11-29 11:41 +1300
      Re: .h and .cpp gwowen <gwowen@gmail.com> - 2011-11-29 07:37 -0800
    Re: .h and .cpp Goran <goran.pusic@gmail.com> - 2011-11-29 00:08 -0800
    Re: .h and .cpp Daniel <danielaparker@gmail.com> - 2011-11-29 08:31 -0800
      Re: .h and .cpp ralph <nt_consulting64@yahoo.net> - 2011-11-29 14:49 -0600
        Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-30 00:21 +0000
  Re: .h and .cpp Andy Champ <no.way@nospam.invalid> - 2011-11-28 21:30 +0000
  Re: .h and .cpp Paavo Helde <myfirstname@osa.pri.ee> - 2011-11-28 18:05 -0600
  Re: .h and .cpp Paavo Helde <myfirstname@osa.pri.ee> - 2011-11-28 18:27 -0600
  Re: .h and .cpp Juha Nieminen <nospam@thanks.invalid> - 2011-11-29 07:55 +0000
    Re: .h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-29 12:15 -0800
      Re: .h and .cpp Leigh Johnston <leigh@i42.co.uk> - 2011-11-29 20:19 +0000
        Re: .h and .cpp Christopher <cpisz@austin.rr.com> - 2011-11-29 12:31 -0800
          Re: .h and .cpp Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-30 00:31 +0000
        Re: .h and .cpp Juha Nieminen <nospam@thanks.invalid> - 2011-11-30 09:43 +0000
      Re: .h and .cpp Ian Collins <ian-news@hotmail.com> - 2011-11-30 09:23 +1300

csiph-web