From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlo Wood To: Dale Johannesen Cc: Kevin Atkinson , Joern Rennecke , Joe Buck , gcc@gcc.gnu.org Subject: Re: Uninitialized warnings Date: Tue, 17 Jul 2001 15:33:00 -0000 Message-id: <20010718003301.A4121@alinoe.com> References: <200107171650.f6HGonw29957@scv2.apple.com> X-SW-Source: 2001-07/msg01228.html 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. For example: void bar(int k) { int i; assert( k >= -1 ); if (k == -1) i = 2; else if (k == 0) i = 3; if (k > 0) foo(3); else #pragma warning 45 push,off // suppress 'possible uninitialized use of i' foo(i); #pragma warning 45 pop } -- Carlo Wood