Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ukma!rutgers!pyrnj!pyrdc!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c Subject: For statement not portable? (was: What does Z["ack"] = 5 mean?) Message-ID: <837@philmds.UUCP> Date: 17 Oct 88 19:47:31 GMT References: <14999@agate.BERKELEY.EDU> <4700019@m.cs.uiuc.edu> <6945@cdis-1.uucp> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 21 In article <6945@cdis-1.uucp> tanner@cdis-1.uucp (Dr. T. Andrews) writes: |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. And then, what standards are we going to support? Those imposed by generally accepted documents, or those thrusted upon you by faulty compilers? If it's going to be the latter, you must already be very sure about how well each and every compiler generates code for each and every C construct. Apart from the fact that this seems hardly doable, one wonders now what other constructs are potentially hazardous... And I liked the for statement so well (and I'm not yet convinced). Leo. for ( t; r; a) n;