Argument Passing in C (Stacks)

Norman Diamond diamond at csl.sony.JUNET
Wed Oct 12 09:41:00 AEST 1988


In <202 at obie.UUCP>, wes at obie.UUCP (Barnacle Wes) writes (almost):

> POP	MACRO	a
> 	L	R5,a
> 	LA	R5,4(R5)
> 	MEND
 
> PUSH	MACRO	a
> 	S	R5,=F'4'
> 	ST	R5,a
> 	MEND

> The problem with these macros is that they are not atomic.  I can't
> think of any straightforward reasons why this is a problem, but I'm
> sure it would cause problems somewhere, somehow.

No problems should be caused by not being atomic.  Real problems are
caused when programmers carelessly use machine instructions such as
POP a   or   PUSH a    and think that they are atomic.  In fact,
such instructions are also non-atomic (nearly always if not always)
and careless programmers create obscure bugs in multiprocessing
systems.
-- 
-------------------------------------------------------------------------------
  The above opinions are my own.   |   Norman Diamond
  If they're also your opinions,   |   Sony Computer Science Laboratory, Inc.
  you're infringing my copyright.  |   diamond%csl.sony.jp at relay.cs.net



More information about the Comp.lang.c mailing list