This is the mail archive of the gcc@gcc.gnu.org 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]

suggestion for C/C++ warning


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Would it be possible to add a warning if a struct is not completely
initialised from a literal?  eg:

typedef struct {
	int a, b, c;
} foo_t;

foo_t goodfoo = {1, 2, 3};		// ok
foo_t badfoo = {4, 5};			// warning?


Clearly use of a constructor is preferable to this initialisation style, but
for maintenance purposes it would be very nice to catch all the places
where a struct is badly initialised after a new member has been added to the
definition.


- -- 
William Brodie-Tyrrell

Carpe Diem - fish of the day.

<william@cs.adelaide.edu.au>                 <william@brodie-tyrrell.org>
http://www.cs.adelaide.edu.au/~william       http://www.brodie-tyrrell.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFBT7mgFyJEO9Vb0C0RAnaQAKCjgpnbWHv4hDqWlONXJCq8V6qctACaA8xB
nBi4v9PkkjZx4Eu1rbiZZBo=
=v5we
-----END PGP SIGNATURE-----


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