lkml.org 
[lkml]   [2006]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] New firewire stack
Ray Lee wrote:
> On 12/4/06, Kristian Høgsberg <krh@redhat.com> wrote:
>> Ok... I was planning to make big-endian versions of the structs so
>> that the
>> endian issue would be solved. But if the bit layout is not consistent, I
>> guess bitfields are useless for wire formats. I didn't know that
>> though, I
>> thought the C standard specified that the compiler should allocate
>> bits out of
>> a word using the lower bits first.
>
> The C standard explicitly allows it to be implementation defined.
> Having been bit by this exact problem, I can also recommend never
> using bitfields for anything other than things kept solely in local
> memory.

Yeah, I just read that paragraph in K&R... sigh. Bitfields make the code so
readable, though :) Anyway, I'll rewrite it to use good old shifting and masking.

Kristian


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-06 00:31    [W:0.053 / U:14.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site