Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP
Path: utzoo!utcsri!greg
From: greg@utcsri.UUCP (Gregory Smith)
Newsgroups: comp.lang.c
Subject: Re: incrementing after a cast
Message-ID: <3774@utcsri.UUCP>
Date: Fri, 12-Dec-86 13:59:13 EST
Article-I.D.: utcsri.3774
Posted: Fri Dec 12 13:59:13 1986
Date-Received: Sun, 14-Dec-86 20:39:49 EST
References: <349@apple.UUCP> <190@haddock.UUCP>
Reply-To: greg@utcsri.UUCP (Gregory Smith)
Organization: CSRI, University of Toronto
Lines: 24
Summary: 

In article <190@haddock.UUCP> karl@haddock.ISC.COM.UUCP (Karl Heuer) writes:
>>(This has to be done anyway when figuring out how to store the stuff.  For
>>example, if you push a byte on the 68000 stack a whole word is used.)
>
>I don't think this is relevant.  If the architecture requires (or the compiler
>prefers) the stack pointer to always be aligned, then push(byte) may have to
>be compiled into movb(byte, *--sp) and clrb(*--sp), but here the adjustment is
>by a constant amount known at compile-time.

On the 68000 ( and PDP-11 ), (sp)+ and -(sp) add or subtract 2 to/from the
sp for byte operands. The 'clrb' method would be non-atomic. So the 'fix'
is done in microcode.
 Whether the odd byte is cleared on a write is a different matter.
It isn't on the PDP-11; movb ...,-(sp) must be followed by clrb -1(sp)
to do that. I seem to recall that a 68000 does a 1-byte write, too,
but you can't then change it to a word by clearing the high byte since
the byte write occurs into the high byte ( confounded bigendians :-)).

As you say, this is irrelevant to the C pointer debate.

-- 
----------------------------------------------------------------------
Greg Smith     University of Toronto      UUCP: ..utzoo!utcsri!greg
Have vAX, will hack...