Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!husc6!purdue!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: Variable-length messages. Message-ID: <926@goofy.megatest.UUCP> Date: 24 Oct 88 19:43:02 GMT Article-I.D.: goofy.926 References: <1988Oct22.231317.19640@utzoo.uucp> Organization: Megatest Corporation, San Jose, Ca Lines: 18 From article <1988Oct22.231317.19640@utzoo.uucp), by henry@utzoo.uucp (Henry Spencer): ) In article <919@goofy.megatest.UUCP) djones@megatest.UUCP (Dave Jones) writes: ))) struct message { ))) int msgType; /* msg type code */ ))) int msgLength; /* length of msg body */ ))) char msgBody[1]; /* variable length msg body */ ))) }; )) ))This looks unsafe to me. That one-char-long "msgBody" can be ))packed into the structure at any of a number of different places, ))depending on the compiler's alignment strategy. ) ) No: X3J11 specifically states that struct member addresses are in ) ascending order ... Is it not possible that one compiler might put msgBody on an even address and another one put it on an odd address, and another one put it on a double-word boundary?