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!linus!philabs!cmcl2!seismo!brl-tgr!ron From: ron@brl-tgr.ARPA (Ron Natalie ) Newsgroups: net.lang.c Subject: Re: Un-alignment in structures Message-ID: <9277@brl-tgr.ARPA> Date: Sat, 16-Mar-85 21:26:57 EST Article-I.D.: brl-tgr.9277 Posted: Sat Mar 16 21:26:57 1985 Date-Received: Mon, 18-Mar-85 03:49:07 EST References: <9251@brl-tgr.ARPA> <317@cmu-cs-k.ARPA> Organization: Ballistic Research Lab Lines: 20 > It is not accurate to say that the VAX has no alignment restrictions. While > a VAX can handle unaligned data, the performance penalty for doing so is > significant. Aligned data is almost always what you want. > > Nevertheless, it wouldn't have killed the PCC-porters to include a > command-line compiler option to turn off alignment for those rare cases when > external unaligned data formats have to be matched.... I'd hardly say significant. There are two peformance penalties to pay for not having things longword aligned. The first is that there is a 64 bit path in to memory. Accesses that straddle the boundry, require two fetches. However, if a structure contains elements such that it unevenly spans a longword boundry, it is unclear that padding the structure out to the doubleword is going to do any good whatsoever. The second problem is that the compiler might make use of some tricks that require longword alignment, but it doesn't. Explicitly setting the pointers to point to non standard alignments works just fine (this is how you get around the moronic struct structure). -Ron