This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] struct member warning
- To: haible at ilog dot fr (Bruno Haible)
- Subject: Re: [patch] struct member warning
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Tue, 3 Mar 1998 00:30:56 +0000 (GMT)
- Cc: egcs at cygnus dot com
> It is a pitfall in C and C++ that a structure can have a static initializer
> which lists less elements that the structure has. The remaining elements
> are silently initialized with 0. This may or may not be what the programmer
> intended. If the programmer intends this, she can easily write the 0es
> explicitly. Here is a patch which adds a warning (triggered by
> "-Wuninitialized").
I think that is the wrong switch. Initialized to zero is considerably
different from uninitialized. If you must have a warning for this
construct (which is sometimes essential for portable code, i.e. to
initialize structs with union members), then IMO it should have a
more fitting name, like -Wimplicit-initialization.