cvs commit: src/sys/dev/ata ata-raid.c

Marcel Moolenaar marcel at xcllnt.net
Sat Jun 11 17:45:27 GMT 2005


On Jun 11, 2005, at 12:25 AM, Stefan Farfeleder wrote:

> On Sat, Jun 11, 2005 at 03:21:20AM +0000, Marcel Moolenaar wrote:
>
>>   Avoid GCC optimizations from injecting a call to memset(?) in order
>>   to initialize the buffer array in ata_raid_attach() by removing the
>>   initializer. There's no memset(?) in the kernel. Instead, assign
>>   '\0' to the first element. The buffer array holds strings only, so
>>   this is functionally equivalent.
>
> Maybe GCC should be taught to generate a bzero call instead?

I tend to agree with des@: the compiler should always initialize
with inline code. If a call to some initialization function (like
memset(3)) is better for the circumstances, the programmer can
always remove the initializer on the declaration and call that
function explicitly.
This leaves the programmer in control, removes questionable
dependencies and assumptions and may actually yield better code
due to the possibility of exploiting alignment and size knowledge.

-- 
  Marcel Moolenaar         USPA: A-39004          marcel at xcllnt.net



More information about the cvs-src mailing list