Hi,
On 04/25/2012 02:31 PM, Daniel P. Berrange wrote:
On Wed, Apr 25, 2012 at 01:46:20PM +0200, Hans de Goede wrote:
Hi,
$subject: Why? The C standard guarantees that if any
member of a struct (or array) gets initialized all non
specifically initialized members will get initalized
to a value of 0.
While you are correct that they get initialized to zero if
omitted, this does not mean your code is going to be bug
free by relying on those semantics.
For example consider code
struct demo {
int foo;
};
and somewhere else miles away in the code, an initializer:
struct demo v = { 1 };
So 'foo' get the value '1'
Now someone comes along and changes the struct to
struct demo {
int bar;
int foo;
};
Now 'bar gets the value 1, but 'foo' gets silently defaulted
to '0'. The initializer is still syntactically correct, but
it is clearly not semantically correct.
Hmm, not really a strong argument, as this breaks the always
add new struct members at the end rule. Anyways I can live with
the change -> ACK.
Regards,
Hans
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel