Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!rochester!uhura.cc.rochester.edu!sunybcs!boulder!ncar!tank!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uicsrd.csrd.uiuc.edu!mcdaniel From: mcdaniel@uicsrd.csrd.uiuc.edu Newsgroups: comp.lang.c Subject: Re: What does Z["ack"] = 5 mean? Message-ID: <44200013@uicsrd.csrd.uiuc.edu> Date: 17 Oct 88 17:42:00 GMT References: <14999@agate.BERKELEY.EDU> Lines: 34 Nf-ID: #R:agate.BERKELEY.EDU:14999:uicsrd.csrd.uiuc.edu:44200013:000:1549 Nf-From: uicsrd.csrd.uiuc.edu!mcdaniel Oct 17 12:42:00 1988 Written 3:17 pm Oct 14, 1988 by knudsen@ihlpl.ATT.COM in comp.lang.c: > In article <6945@cdis-1.uucp>, tanner@cdis-1.uucp (Dr. T. Andrews) writes: > > In article <4700019@m.cs.uiuc.edu>, kenny@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@uicsrd.csrd.uiuc.edu UUCP: {uunet,convex,pur-ee}!uiucuxc!uicsrd!mcdaniel ARPANET: mcdaniel%uicsrd@uxc.cso.uiuc.edu CSNET: mcdaniel%uicsrd@uiuc.csnet