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


Bernard Dautrevaux <Dautrevaux@microprocess.com> writes:

| > -----Original Message-----
| > From: Gabriel Dos Reis [mailto:gdr@codesourcery.com]
| > Sent: Tuesday, February 05, 2002 5:21 PM
| > To: dewar@gnat.com
| > Cc: gdr@codesourcery.com; aoliva@redhat.com; coola@ngs.ru;
| > gcc@gcc.gnu.org; pcarlini@unitus.it
| > Subject: Re: a warning to implement
| > 
| > 
| > dewar@gnat.com (Robert Dewar) writes:
| > 
| > | <<Then you're wrong because the issue of the debate wasn't 
| > whether it
| > | should be valid statement; the issue was whether it could 
| > be a useful
| > | construct -- incidentally some wanted to make it ill-formed.
| > | >>
| > | 
| > | Sorry, I can't imagine any useful use of this construct
| > 
| > That *you* can't imagine a useful use of that construct doesn't mean
| > other people don't. Other people do imagine, in the same way people
| > have uses of SNaNs.
| 
| There's a little difference here: SNaNs have a definite behaviour,

Since you're arguing from a language standard point of view, SNaNs
don't have definite behaviour, therefore I don't buy your statement:
| which is
| different from NaNs; however, from a language point of view, "int x = x;" is
| exactly equivalent to "int x;" and really different from "int x = x0;". 


Firstly, certainly the warning won't be restricted to int.  I think it
will be implemented for every object type T.  Now it you condiser the
construct 

   T x = x;

then it is not equivalent to 

   T x;

Now, even in the case of fundamental interger type T, since the
value of x is an inderterminate, that construct can be used to give
an explicit hint to the compiler to handle  x  in special way --
e.g. it may have a trap representation if used in a context where
there were no intervening assignment which changed x's value in a
definite way.  Pretty much, in the same of SNaNs.

Please, note that I'm not saying that GCC should not have an option to
trigger the proposed warning. I'm saying that that shouldn't be on by
default in -Wall.

[...]

| ALL these constructs are perfectly valid,

I'll repeat it one more time:  I'm not agruing the validity of the
construct. 

-- Gaby


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