Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!brl-adm!adm!rgenter@j.bbn.com
From: rgenter@j.bbn.com (Rick Genter)
Newsgroups: comp.lang.c
Subject: conditional expression evaluation
Message-ID: <2356@brl-adm.ARPA>
Date: Thu, 15-Jan-87 05:21:14 EST
Article-I.D.: brl-adm.2356
Posted: Thu Jan 15 05:21:14 1987
Date-Received: Thu, 15-Jan-87 22:25:07 EST
Sender: news@brl-adm.ARPA
Lines: 26

> The
> other example with the *cp++'s was subtle and at worst confusing.

Not only that, but it was outright wrong.  Since the only guarantee on ++
is that it will be evaluated before the start of the next statement, the
compiler is free to implement the expression as:

	if ( (booltemp = *cp | *cp | *cp, cp += 3, booltemp) ) {
		...
	}

or, alternatively,

	if ( (cp += 3, *cp | *cp | *cp) ) {
		...
	}

or any other combination or permutation of increment and dereference.  The
only way to be safe is to never have the same object undergo two side effects
in the same statement/expression.
					- Rick
--------
Rick Genter 				BBN Laboratories Inc.
(617) 497-3848				10 Moulton St.  6/512
rgenter@bbn.COM  (Internet new)		Cambridge, MA   02238
rgenter@bbnj.ARPA (Internet old)	seismo!bbn.com!rgenter (UUCP)