What does Z["ack"] = 5 mean?

mcdaniel at uicsrd.csrd.uiuc.edu mcdaniel at uicsrd.csrd.uiuc.edu
Tue Oct 18 03:42:00 AEST 1988


Written  3:17 pm  Oct 14, 1988 by knudsen at ihlpl.ATT.COM in comp.lang.c:
> In article <6945 at cdis-1.uucp>, tanner at cdis-1.uucp (Dr. T. Andrews) writes:
> > In article <4700019 at m.cs.uiuc.edu>, kenny at m.cs.uiuc.edu writes:
> > ) ...implementors, notably Encore, have been lax about implementing
> > ) integer[pointer] and integer +- pointer.  It is unwise to depend on
> > ) either form's working in portable code; ...
> > It is also possible that compiler writers will get the "for" loop
> > handling wrong.  It is unwise to depend on "for" loops in portable
> > code.  Use a "while" loop instead.
>
>Could you elaborate more on what kind of errors are most likely
>in compiling for loops?  In testing?  Incrementing?

Um, I think (I hope) Dr. Andrews was being sarcastic.

The C language, as defined by the dpANS and K&R's second edition (and
arguably first edition), says that "i[p]" is equivalent to "p[i]" and
"i+p" is equivalent to "p+i", if "i" is an integer type and "p" is a
pointer type.  "i[p]" and "i+p" are as much a part of the language as
"for".  If a compiler does not accept such syntax, it's not a C
compiler; it's a compiler for a language that resembles C.

I don't think "i-p" is legal, though, Ken.

-- 
Tim, the Bizarre and Oddly-Dressed Enchanter
Center for Supercomputing Research and Development
at the University of Illinoid at Urbana-Champaign

Internet, BITNET:  mcdaniel at uicsrd.csrd.uiuc.edu
UUCP:    {uunet,convex,pur-ee}!uiucuxc!uicsrd!mcdaniel
ARPANET: mcdaniel%uicsrd at uxc.cso.uiuc.edu
CSNET:   mcdaniel%uicsrd at uiuc.csnet



More information about the Comp.lang.c mailing list