From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3EB8B69D.5040107@ameritech.net> From: northern snowfall User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.4.1) Gecko/20020518 Netscape6/6.2.3 MIME-Version: 1.0 To: 9fans@cse.psu.edu Subject: Re: [9fans] struct problems References: <20030507043633.GX36080@cassie.foobarbaz.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 7 May 2003 02:32:45 -0500 Topicbox-Message-UUID: a10a193a-eacb-11e9-9e20-41e7f4b1d025 Structures are aligned to the underlying platform's specifications which may cause problems if you expect raw data to align to your C structure bit- for-bit: it won't happen. IIRC, this is the reason why plan9 code uses the convX2Y() functions, making sure data represented in a struct is represented properly by the underlying architecture. Some people go the B route and use uchar[] for every structure member, which causes more CPU cycles later when analyzing data. In my experience it's just better to parse the raw data into the specific structure using a conversion routine, possibly inlined. Bitfields will only augment this issue in your code and decrease portability. Don