suggestion for C/C++ warning

William Brodie-Tyrrell william@cs.adelaide.edu.au
Tue Sep 21 07:57:00 GMT 2004


-----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-----



More information about the Gcc mailing list