powerful expressions

Tim_N_Roberts at cup.portal.com Tim_N_Roberts at cup.portal.com
Wed Dec 6 08:10:56 AEST 1989


In <12855 at cit-vax.Caltech.Edu>, wen-king at cit-vax.Caltech.Edu (King Su)
shares:

>	((qhead) ? (qtail = qtail->next = qnew)
>		 : (qtail = qhead       = qnew))->next = 0;

I am truly sorry for the order-of-evaluation flood that I am surely about
to bring down upon myself, but...

Is this guaranteed to work?  Does ANSI require a sequence point in
(qtail = qtail->next = qnew) so that it works?  I have always been
hesitant to write something like that, because I felt that the compiler
could reasonably be expected to assign qnew to qtail first and thereby
screw up qtail->next.  Am I fearing needlessly?

TNR at cup.portal.com                  |  "Your Tax Dollars At Work."
...!sun!portal!cup.portal.com!tnr   |  If it wasn't so sad, it'd be funny.



More information about the Comp.lang.c mailing list