This is the mail archive of the 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

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.

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