Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: For statement not portable? (was: What does Z["ack"] = 5 mean?) Message-ID: <23@auspex.UUCP> Date: 19 Oct 88 16:34:27 GMT References: <14999@agate.BERKELEY.EDU> <4700019@m.cs.uiuc.edu> <6945@cdis-1.uucp> <837@philmds.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 16 >|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. > >The semantics of the "for" statement seem pretty clear, though (see >K&R Appendix A, 9.6 & 9.8, 9.9). Could you be a bit more specific about >how they get it wrong? I didn't see any compilers broken in this respect >yet. If there are any, they would break a lot of existing code. Gee, I thought the comment about the "for" loop was rhetorical, inserted only to indicate that if you decide to avoid using legal C constructs (and subscripting an integer by an array most definitely *is* legal) because some implementor might get them wrong, there's no clear place to stop - hey, if they don't treat "a[b]" as "*(a + b)" as they're supposed to, they might get "for" wrong, and then they might even get "while" wrong too. I didn't think it was referring to some known problem.