| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | structure alignment |
PE> I don't know. Always code on the assumption that structures
PE> aren't aligned in a particular manner, and you will end up
PE> with portable code. BFN. Paul.
I'm not so sure. This is the structure:
typedef struct {
unsigned short zone; /* FTN zone number */
unsigned short net; /* FTN net number */
unsigned short node; /* FTN node number */
unsigned short point; /* FTN point number */
} EZYNETADDR;
typedef struct {
unsigned short prevreply; /* Message to which this replies */
unsigned short nextreply; /* Message which replies to this */
unsigned long text_ofs; /* Physical offset of message text into
* MSGT???.BBS */
unsigned long msg_len; /* Message text length (including null
* terminator) */
EZYNETADDR orig; /* Originating network address of this
* message */
EZYNETADDR dest; /* Destination network address of this
* message */
unsigned short cost; /* Cost of message in lowest unit of
* originator's currency */
unsigned char msgattr; /* EZYMSG_M_xxx */
unsigned char netattr; /* EZYMSG_N_xxx */
unsigned char rsvd1; /* reserved */
unsigned long date_written; /* Date that the message was written */
unsigned long date_received; /* Date that the message was received */
unsigned char toname[36]; /* Name of user to whom this message is
* addressed; counted string */
unsigned char fromname[36]; /* Name of user who created this message;
* counted string */
unsigned char subject[73];/* Message subject; counted string */
} EZYMSGHDR;
I wrote a small program to report sizeof(EZYMSGHDR). Borland C++ 3.1
reported the correct size, 186 bytes; Microsoft QuickC 2.5 reported 188
bytes, due to its default of 2-byte structure alignment. Perhaps it has
something to do with EZYNETADDR being nested inside EZYMSGHDR. I will
investigate when I have some more time, but in my opinion the behavior of
QuickC's default structure aligning is unacceptable, based on the above
structure.
andrew
--- Maximus 2.02
* Origin: Valhalla, Melbourne, Australia +61-3-9302-3775 (3:633/267)SEEN-BY: 50/99 620/243 623/630 632/348 998 633/154 252 253 260 262 267 371 SEEN-BY: 633/373 634/384 635/301 502 503 544 636/100 639/100 711/401 409 410 SEEN-BY: 711/430 510 807 808 809 932 934 712/515 713/888 714/906 800/1 SEEN-BY: 7877/2809 @PATH: 633/267 252 371 635/503 50/99 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.