C (32/178)

From:torrelli
Date:12 Jul 2000 at 19:35:25
Subject:Re: ExamineFH() Problems

> > I understand that the FileInfoBlock structure has to be longword
> > aligned and I think this is where my problem lies;
>

Here is a macro I use for aligning structures on long words..
should work with any decent compiler.
Notice that it wastes 3 octets for each object it allocates on the stack.

#define DCLEVNEVN( T, N ) char blk##N[3+sizeof(T)]; \
T *N = (T *)((((unsigned long)(blk##N+3)/4)*4));

You use it in the declaration part of the block this way:

in place of
struct FileInfoBlock *fib;
do
DCLEVNEVN( struct FileInfoBlock , fib );

Hope it helps.

Phil.

------------------------------------------------------------------------
LOW RATE, NO WAIT!
Get a NextCard Visa, in 30 seconds! Get rates
as low as 2.9% Intro or 9.9% Fixed APR and no hidden fees.
http://click.egroups.com/1/6632/1/_/451227/_/963423778/
------------------------------------------------------------------------