C (31/178)

From:Colin Wenzel
Date:12 Jul 2000 at 18:58:44
Subject:Re: ExamineFH() Problems

On 13-Jul-00, torrelli@mctel.fr wrote:
>>> 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.

-snip-

Here is a macro I employ to use temporary stack storage
for these sort of situations & longword align it..

Note: allocation MUST be at least 4 bytes bigger than you need.
because alignment rounds up to next longword.

#define LALIGN(x) ((x+3L)&0xFFFFFFFCL)

AUTO UBYTE fbuffer[ sizeof(struct FileInfoBlock) + 4L ];
STRUCT FileInfoBlock *fib;

fib = LALIGN ( fbuffer );

Examine(lock, fib);
................

Regards



_________________________________________

Colin Wenzel. Australia.

EMAIL: colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.5, Spectrum Gfx Card.
_________________________________________

------------------------------------------------------------------------
Experience MSN...
Get 1 FREE* month of unlimited Internet access!
http://click.egroups.com/1/6323/1/_/451227/_/963424886/
------------------------------------------------------------------------