use of if (!cptr) and if (cptr), where cptr is a *

Leslie Mikesell les at chinet.chi.il.us
Sun Jul 23 06:02:13 AEST 1989


In article <10103 at mpx2.mpx.com> erik at mpx2.mpx.com (Erik Murrey) writes:

>while (myptr= my_func(), myptr->x != myptr->y) {
>	...
>}
>I would kinda like to see that one in your style...

I'd use: 
while (myptr = my_func() && myptr->x != myptr->y) {
 }

which would detect a null pointer returned by my_func() as well as
providing a guaranteed order of evaluation.  

Les Mikesell



More information about the Comp.lang.c mailing list