On Wed, 13 Apr 2011, Chris Ball wrote:

> Converts from:
>       struct mmc_command cmd;
>       memset(&cmd, 0, sizeof(struct mmc_command));
> 
> to:
>       struct mmc_command cmd = {0};
> 
> because it's shorter, as performant, and easier to work out whether
> initialization has happened.

Did you disassemble the resulting binary to make sure this is actually 
as performant?

I'm asking because gcc used to do a horrible dumb job with such patterns 
where it would allocate two instances of the structure on the stack i.e. 
one for the named variable and one for the initializer, then fill the 
later with zeroes, and then call memcpy() to copy the initializer over 
to the named instance.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to