Portability and alignment constraints

Chris Torek chris at mimsy.UUCP
Thu May 19 19:18:57 AEST 1988


In article <10886 at steinmetz.ge.com> davidsen at steinmetz.ge.com
(William E. Davidsen Jr) writes:
>  Without commenting on the original issue ... I would like to say that
>Terry is *not* the only person getting in trouble on the Sun4.

(Probably not; but no one else seems to immediately denounce the
machine because of this.)

>A number of major machines (VAX, 80x86, 68xxx) lose
>performance when alignment is not preserved for 2 byte and 4 byte
>quantities, but they will access the data.

On the other hand, a number of major machines (Pyramid, before the
microcode tweak that allowed *(long*)((addr&~3)+2); CCI/Harris/Sperry
Power 6/32; and as you mention, some Honeywell machines) have
restrictions like those in the SPARC architecture.  As far as
I know, the Pyramid still disallows short and long word accesses
on odd byte addresses, as does the 68000 and 010 (but not 020)
and the venerable PDP-11 series.

>  Since there is no alignment algorythm which applies in all cases,
>exchanging binary data requires some assumption, and that is "no
>alignment.'

Exchanging binary data has more than just alignment problems: aside
from integer endian-clashes, there are a multitude of floating point
formats.  Not even the number of bits per byte is fixed.  Portable
programs rely on some other method of exchanging data (RPC library,
ASCII interchange, etc.).

As long as the claim is only `I do not like it', I shall stand aside.
I am not unsympathetic---I had to fix numerous Vaxisms in Gosling Emacs
when we first got our Pyramid (one of those that did not support
*(long*) unless the address was 0 mod 4); finding all of these was no
fun at all---but when someone claims that the machine is `broken', or
does not abide K&R, or various other falsehoods, I will post
corrections.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list