Re: [PATCH 1/3] mmc: initialize struct mmc_command at declaration time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux