For statement not portable? (was: What does Z["ack"] = 5 mean?)

Stephen J. Friedl friedl at vsi.COM
Wed Oct 19 13:19:03 AEST 1988


In article <6945 at cdis-1.uucp> tanner at 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.

In article <837 at philmds.UUCP>, leo at philmds.UUCP (Leo de Wit) writes:
> 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.

Hold it hold it everybody.  The only thing wrong with Dr.
Andrews' note is the lack of the :-).

The posting to which he was responding claimed that since some
compilers can't hack "int[ptr]" array indexing that it should be
considered nonportable. Well, int[ptr] is well-defined in the C
language, and if a compiler doesn't support it then the compiler
is broken.  Dr. Andrews is making this point with sarcasm.

-- 
Steve Friedl    V-Systems, Inc.  +1 714 545 6442    3B2-kind-of-guy
friedl at vsi.com     {backbones}!vsi.com!friedl    attmail!vsi!friedl
---------Nancy Reagan on the Three Stooges: "Just say Moe"---------



More information about the Comp.lang.c mailing list