Aztec C (was: more eBay stuff)

Fred Cisin cisin at xenosoft.com
Fri Jun 1 14:00:46 CDT 2007


> > > For example, what would you expect from:
> > > N = 1;
> > > A[N++] = N++;

> > On the other hand, I'd fire anyone who wrote something like the above.
> Out of a cannon, hopefully.
. . . into the sun.   (Turanga Leela explaining to Philip Fry that "you
gotta do what you gotta do")

> Unfortunately, I've seen my share of
> messes caused by tricks similar to this.
. . . followed by complaints that the compiler didn't do what they
expected, and claims that there is a bug in the compiler, because it
behaved differently than their "baby duck" compiler.

In the first semester of C, I try to teach students to optimize for
readability, and to avoid compound steps.  But, in the second semester, I
get some students who have learned bad habits, and think that they are
"optimizing" their code when they attempt to write Holub-style "puzzle"
code.  Even an erudite explanation, such as what Dave posted, gets a
response of "well, it works on xxx compiler!"


It is true, that scope of variables IS defined, and should function as
expected.  But there were a LOT of variations in early compilers, some
legit, and some bad.
Complex compound lines, even when they follow all of the rules, such as:

while (*T++=*S++);

make finding and isolating problems difficult.

--
Grumpy Ol' Fred     		cisin at xenosoft.com


More information about the cctalk mailing list