Mail Archives: djgpp/1997/03/23/06:46:33
On Fri, 21 Mar 1997, Regis BOSSUT wrote:
> 1) The packed attribute is not of any help, since the items of ncb are
> already correctly aligned.
Did you actually tried to add ``__attribute__(packed))''? Because I
think that you are wrong in assuming that NCB is already aligned.
Here:
> #define BYTE unsigned char
> #define WORD unsigned short
> #define DWORD unsigned int
>
> typedef struct {
> BYTE ncb_command;
> #define NCBASTAT 0x33
> BYTE ncb_retcode, ncb_lsn, ncb_num;
> char *ncb_buffer; WORD ncb_length;
> BYTE ncb_callname[16], ncb_name[16];
> BYTE ncb_rto, ncb_sto;
> int (*ncb_post)(); <<<<<<<<<<<<
> BYTE ncb_lana_num, ncb_cmd_cplt; <<<<<<<<<<<<
> char *ncb_vname; <<<<<<<<<<<<
> BYTE ncb_vnamelen;
> BYTE ncb_reserve[9];
> } NCB;
The 3 marked lines show that *ncb_vname (a 4-byte pointer) is not
aligned, because there are only 2 bytes between it and the preceding
(*ncb_post)(), which is a 4-byte pointer to a function. Am I missing
something?
- Raw text -