One more point regarding = and == (more flamage)
Doug Gwyn
gwyn at smoke.brl.mil
Sat Mar 23 07:30:09 AEST 1991
In article <13603 at helios.TAMU.EDU> byron at archone.tamu.edu (Byron Rakitzis) writes:
>I have one more thing to say to the self-styled C gods who approve of
>simple assignments as an implicit test against zero inside an if-statment.
If that was intended as criticism of me in particular, all I can say
about it is that one should understand the gods before criticizing them.
>b) while ((*foo++ = *bar++) != 0)
That's in fact the way I would code this particular case, which I
consider a "straw man". On the other hand, I frequently write code such as:
bool status;
...
if ( status = WriteHeader() )
...
else
...
return status;
for which I would be extremely annoyed to receive gratuitous warnings from
the compiler!
More information about the Comp.lang.c
mailing list