> > In practice a lot of code assumes that if
> > if you do all padding yourself so structure members are naturally aligned[*]
> > gcc will leave them in the order they are in and not add padding.
> If structure members are laid out the right way, no padding is added. As
> claimed, depends on architecure, CPU family, optimization flags, ...
> > There is no reason to require readb() to compute offsets by hand while
> > letting TCP, DMA code aso use structs ( (u32 *)ip_header)[IP_SADDR] =
> > source_address; - yuck), and what I'm saying there is no reason to "fix"
> > drivers that use structs for readb() offsets.
> TCP was designed for natural alignment of the fields, for efficiency. This
> is _not_ to be taken for granted for any random struct.
We aren't talking about random structs. We're talking about structs which
have been explicitly padded so all members are naturally aligned.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:23 EST