Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Sep 2000 15:17:06 -0700 (MST)
From:      "Chad R. Larson" <chad@DCFinc.com>
To:        bsd@shell-server.com (BSD)
Cc:        msa@dinosauricon.com, stable@FreeBSD.ORG
Subject:   Re: Constant panics on 4.1-STABLE!
Message-ID:  <200009252217.PAA22260@freeway.dcfinc.com>
In-Reply-To: <Pine.BSF.4.10.10009232316590.62035-100000@marvin.shell-server.com> from BSD at "Sep 23, 0 11:20:02 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
As I recall, BSD wrote:
> C doesn't guarantee order of execution in if ( bleh && bleh && bleh).
> It may very well evaluate it backwards, or from the inside out if it
> wants.  No?

Not quite.  C is free to rearrange the order in which an expression
is evaluated.  But the logical operators "&&", "||", ":?" and the
comma operator define "sequence points" at which all previous side
effects of execution are to have taken place and at which no
subsequent side effects will have occurred.

So, if your "bleh" above is an expression, "(a+b)+(c+d)", it could be
evaluated as "(a+d)+(b+c)", but the seperate logical values would be
tested in order.

Reference: Harbison & Steele, Fourth Edition, sections 7.2 and 7.12.

	-crl
--
Chad R. Larson (CRL15)   602-953-1392   Brother, can you paradigm?
chad@dcfinc.com         chad@larsons.org          larson1@home.net   
DCF, Inc. - 14623 North 49th Place, Scottsdale, Arizona 85254-2207


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009252217.PAA22260>