Compilers and programming style (was Re: A question of style)

Scott Amspoker scott at bbxsda.UUCP
Thu Jan 11 09:40:22 AEST 1990


In article <2288 at dataio.Data-IO.COM> bright at dataio.Data-IO.COM (Walter Bright) writes:
>In article <534 at bbxsda.UUCP> scott at bbxsda.UUCP (Scott Amspoker) writes:
><In article <2283 at dataio.Data-IO.COM> bright at dataio.Data-IO.COM (Walter Bright) writes:
><<volatile int *p;
><<*p;		/* has side effects and must not be optimized away	*/
><Just curious - what kind of code should be generated for the above C fragment?
>
>Should be something like:
>	MOV BX,p
>	MOV AX,[BX]

I don't mean to be a pain in the butt but I want to make sure I
understand what's going on.  Several posters have responded with
similar code examples.  *Is this documented in the ANSI spec?*
It's a nice "feature" and all, but....

(The reason I ask is that there are usually two kinds of postings
in this newsgroup - those that discuss C as it really is (which
I care about) and those that discuss C as someone would like
it to be (which are a waste of my time).  I sometimes have
trouble telling the two apart.  I currently don't have the
ANSI draft at my disposal but I do have compilers that claim
to be ANSI compatible with reasonably good documentation.
None of this discusses any semantics for "*p;".)

-- 
Scott Amspoker
Basis International, Albuquerque, NM
(505) 345-5232
unmvax.cs.unm.edu!bbx!bbxsda!scott



More information about the Comp.lang.c mailing list