This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: a warning to implement


> -----Original Message-----
> From: Per Abrahamsen [mailto:abraham@dina.kvl.dk]
> Sent: Sunday, February 10, 2002 3:01 PM
> To: gcc@gcc.gnu.org
> Subject: Re: a warning to implement
> 
> 
> Gabriel Dos Reis <gdr@codesourcery.com> writes:
> 
> > What I'm saying is that if you want to be warned about that 
> construct
> > then you should explicitly turn on the appropriate flag.  In this
> > case, I do think -Walll should -not- turn that flag on.  
> 
> The manual says this about -Wall:
> 
>   `-Wall'
>        All of the above `-W' options combined.  This enables all the
>        warnings about constructions that some users consider
>        questionable, and that are easy to avoid (or modify to 
> prevent the
>        warning), even in conjunction with macros.
> 
> An example of a warning produced by -Wall:
> 
>   void foo (const char* p, char* q)
>   {
>     while (*q = *p)
>       { ++q; ++p; }
>   }
> 
>   test.cc: In function `void foo(const char *, char *)':
>   test.cc:3: warning: suggest parentheses around assignment 
> used as truth value
> 
> It is clear that _some_ users consider assignment as truth value
> questionable, and it is easy to avoid.  Thus, it is a good example of
> a -Wall warning.  Just to set the level we are talking about.
> 
> Are you saying the "T x = x" is less questionable or harder to work
> around than the above?
> 
> Personally, not being one of the super programmers on this 
> list, I have
> lost a couple of days work debugging errors caused by accidental use
> of the "T x = x" construct, which I at the time didn't even knew was
> legal, so I would have loved to have had a warning with -Wall, but
> wouldn't even have thought of searching for a separate flag.
> 

I can only agree with that :-)

However there seems to be such a strong opposition to having this warning
installed by default in -Wall that I think we should at least provide it as
an additional warning flag; it's useful enough that we may get it.

Anyway for me, that doesn't change a lot: I'm not even setting -Wall in my
makefiles: it's set up in some central place so that ALL compiles by ALL
developpers in my teams use it without even knowing that I've decided it;
thus I only have to add -Wself-initialize, or whatever it'll be called, to
this single location and all my programmers will have it :-)

I think this thread is now long enough we all refrain continuing this
religion war about whether this should be in -Wall or not (unless there is
some authoritative person that can get convinced and can rule about this
:-)).

Best regards, and thanks to all for the good work.

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]