Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA From: cottrell@nbs-vms.ARPA Newsgroups: net.lang.c Subject: alignment of struxures Message-ID: <6954@brl-tgr.ARPA> Date: Thu, 3-Jan-85 18:32:26 EST Article-I.D.: brl-tgr.6954 Posted: Thu Jan 3 18:32:26 1985 Date-Received: Sat, 5-Jan-85 02:13:02 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 26 /* 1) why not make all struxures unaligned, requiring explicit alignment by the programmer? pdp-11 (& vax?) assemblers require an explicit '.even' or such. i know it's a burden, but then any struxure would be possible. 2) in the meantime, try this: #define BYTE(x) (*((char *)(x))) #define WORD(x) (*((short*)(x))) #define LONG(x) (*((long *)(x))) then struct ugly { char a; char longint[4]; /* really a long int */ ... } yuk; to get the long int do: barf = LONG(yuk.longint); 3) have fun! */