use of if (!cptr) and if (cptr) && a programming error

David Olix dwho at nmtsun.nmt.edu
Sat Jul 22 06:01:39 AEST 1989


[Skipping all the "In article..." stuff]
>[Material everybody has seen n times deleted.]
>I am kind of butting in [ :-) ], but how 'bout
>        while ( ( myptr = my_func() )->x != myptr->y )
>                {
>                }

>THAT WILL NOT WORK! [...]

Actually, "Mastering C" by Craig Bolon, SYBEX Inc., p. 273 says that
parenthesis operators have the HIGHEST priority, therefore what's inside
(myptr = my_func()) would get evaluated first.  Also, it specifies that
grouping for the '!=' operator is from left to right.  Now, the author of
this book may have been wrong....  Anyone seen an "official" statement
from K&R?

--David Olix (dwho at nmtsun.nmt.edu)



More information about the Comp.lang.c mailing list