Current-Users archive

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

Re: sys/dev/scsipi/scsipi_base.c



Alan Barrett <apb%cequrux.com@localhost> writes:
> On Sun, 06 Jan 2008, David Laight wrote:
>> > memcpy(inqbuf->vendor, "ADAPTEC ACB-4000            ", 28);
>> > yet inqbuf->vendor is declared in struct scsipi_inquiry_data as:
>> > char    vendor[8];
>> and is followed by:
>>   char    product[16];
>>   char    revision[4];
>> so the memcpy updates all 3 fields :-)
>
> This is rather ugly, but it's either guaranteed to work, or will work
> with all except the most perverse C language implementations.

True, but is there a good reason to commit a type violation just to
save an inconsequential amount of time and space by avoiding two more
calls?

Perry



Home | Main Index | Thread Index | Old Index