use of if (!cptr) and if (cptr), where cptr is a *
Dave Paulson
dpaulso at ark1.nswc.navy.mil
Sat Jul 22 07:34:53 AEST 1989
In article <14580 at dartvax.Dartmouth.EDU> ari at eleazar.dartmouth.edu (Ari Halberstadt) writes:
>[...]
>
>One place I've found the comma operator to be very useful is when an error
>must be handled and an error code returned from a function:
> if (error)
> return(perror("it failed"), FALSE);
>This saves the nuisance of using braces and two statements.
I don't usually like to complain about other people's coding
preferences, but this just struck a nerve.
This is just plain ugly. When *I* see a comma operator, I tend to think
of two things being done in parallel, so the impression I get when
reading this segment is different from what is really going on.
Besides, what's so doggone hard about adding a couple extra
braces and semi-colons?
Oh well, back to my cage.
More information about the Comp.lang.c
mailing list