This is the mail archive of the
mailing list for the GCC project.
Re: Uninitialized warnings
On Tue, Jul 17, 2001 at 09:51:06AM -0700, Dale Johannesen wrote:
> we're the first people to think of this, which gives me pause. Is a
> patch that checks for uninitalized variables even without optimization
> likely to be accepted?
Please don't add any warning that can generate false positives.
I'd rather have no warning at all for 100 actual bugs than
100 correct warnings and a false positive. The reason for
that is that I always use -Werror: I want gcc to abort when
a warning is generated. The reason for THAT is that a warning
always means that something *is* wrong and will (likely) cause
a runtime error.
If I'd have to suggest an alternative/compromise, then I'd say:
make it possible to temporally turn off a specific warning in
the source code.
void bar(int k)
assert( k >= -1 );
if (k == -1)
i = 2;
else if (k == 0)
i = 3;
if (k > 0)
#pragma warning 45 push,off // suppress 'possible uninitialized use of i'
#pragma warning 45 pop
Carlo Wood <firstname.lastname@example.org>