[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: problem with unaligned access on Alpha



Wessels, Hans wrote:
> 
> On 25 juni 1999 Maciej W. Rozycki wrote:
> 
> > Using unions is good when you are sure all data is aligned.  If that's
> >not the case, the problem remains.  The "packed" approach is reasonable
> >but not necessarily the best.
....
> I am using the following macro to get alignment of elements in an
> malloced memory block:
[ snip ]

Aligning your own data is usually not a very big problem.  egcs does a
pretty good job with it by itself; sometimes too good. :-) But from time
to time you have to pick apart "alien" structures - like ethernet packet
headers, or file system descriptors, or you name it.  They have their
own layout and alignment requirements, which you cannot change, and one
has to be a bit careful not to run afoul of a compiler.

  Michal



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []