C99 structure initialisers and Samba3

Stefan (metze) Metzmacher metze at samba.org
Wed Aug 23 11:54:11 GMT 2006


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

tridge at samba.org schrieb:
> Metze,
> 
>  > - -Wmissing-field-initializers
>  >   Warn if a structure's initializer has some fields missing.
>  >   For example, the following code would cause such
>  >   a warning, because "x.h" is implicitly zero:
>  > 
>  >                    struct s { int f, g, h; };
>  >                    struct s x = { 3, 4 };
> 
> Doesn't the C standard say that trailing missing initializers are
> guaranteed to be zero? I thought we relied on that in some places.

yes and it still is, but generate a warning.

I think we don't want to to reply on implicit values.

It's the same like:

uint8_t foo[8];
char *str;
str = foo;

that's valid C code, but we want to get a warning if it's not written
explicit like this;

str = (char *)foo;

metze
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFE7EHim70gjA5TCD8RAjREAJ9izjT0TVBK5i9ImbQSS3byvxqzZACbBDF2
JnGixBW73AHEfxRndUUbw8c=
=dB3w
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list