This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
suggestion for C/C++ warning
- From: William Brodie-Tyrrell <william at cs dot adelaide dot edu dot au>
- To: gcc at gnu dot org
- Date: Tue, 21 Sep 2004 14:48:24 +0930
- Subject: suggestion for C/C++ warning
- Organization: University of Adelaide School of Computer Science
-----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-----