One more point regarding = and == (more flamage)

Steve Summit scs at adam.mit.edu
Fri Mar 29 12:57:09 AEST 1991


In articles too numerous to mention, people are asserting that

	while(*a++ = *b++)

is or is not good style.  At this point neither side is likely to
convince the other.

If you like

	while(*a++ = *b++)

keep on using it.  Neither I nor any other Usenet poster is going
to (or can) stop you.

If you prefer

	while((*a++ = *b++) != 0)

more power to you, and keep on using it.

If you're undecided, don't let the assertions being made ("THIS
is good style, and I have Spoken") sway you unnecessarily.
Decide for yourself which is clearer and least likely to be
misunderstood by future maintainers.  Whichever way you choose,
you've got precedents -- there is obviously no consensus on which
way is "best."

A colleague of mine once expressed a bit of dismay that he'd
never be a "good" C programmer, because he couldn't write, and
didn't feel like learning how to write, the supercompressed code
he saw all around him.  He was writing perfectly good code, but
he was tending to leave things explicit and obvious.  It is a sad
commentary on our little subprofession that barely-penetrable
code is so widespread that it can be perceived as a requirement.

Codesmanship (or, job security through obscurity) is alive and
well.

                                            Steve Summit
                                            scs at adam.mit.edu



More information about the Comp.lang.c mailing list