This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: a warning to implement
- From: dewar at gnat dot com (Robert Dewar)
- To: gdr at codesourcery dot com, jbuck at synopsys dot com
- Cc: aoliva at redhat dot com, dewar at gnat dot com, gcc at gcc dot gnu dot org, phil at jaj dot com
- Date: Wed, 6 Feb 2002 14:56:58 -0500 (EST)
- Subject: Re: a warning to implement
But Gaby, right now, the construct
int a = a;
produces an undefined result, so no one can use it. It might suppress
warnings in one version of gcc, but then someone might submit a patch
that causes it to have some disastrous effect, and no one would have
a right to complain, since if they are using this, they are using an
undocumented behavior, and have no right to count on it.
So the idea of excluding this from -Wall would make sense ONLY if you
make the effect of suppressing warnings an official part of the gcc
semantics. In short only the following make sense:
1. Make this an official construct for the purpose of suppressing warnings
for uninitialized variables, and document that it has no other (ill) effect.
You can then decide whether to put the warning for this non-standard
construct in -Wall or not.
2. Leave this as it is now, undefined, in which case there can be no objection
to it being in -Wall, and indeed those people injudiciously using this
consruct to suppress warnings will be warned that this usage is neither
blessed nor guaranteed.
Frankly I would be surprised if you could get a consensus for approach 1.