Subject: Re: Question
To: Lennart Augustsson <augustss@cs.chalmers.se>
From: Matthew Jacob <mjacob@feral.com>
List: port-alpha
Date: 12/10/1998 08:32:24
> 
> > Oh, why do we always go through this..... If you have a device that
> > imposes some byte and bit position specific protocol, you cannot assume
> > that you can coerce a C structure to it *anyway*- you may get lucky for
> > platform #N, but if you're writing portable code you should also include
> > macroized or inlined (de)canonicalization functions. 
> 
> I think I'm being pretty careful in defining and accessing the data in
> those structs.  All fields in the struct have byte size, so I don't
> assume much of the C compiler.  I certainly assume less than e.g. the
> netinet/ip.h definition of struct ip does.
> 

Oh- I didn't mean to sound critical... The point here is that you don't
control what the compiler does for structure padding and alignment. If you
*do* have a structure that 'just works' great- if you don't (and I guess
that you don't if you're getting alignment faults- or have I been a real
bonehead here?)- then you have to have something that will do the
structure translation for you (XDR).