🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1474

Re: := versus ==

#1474
From: Darren New
Date: Thu, 09 Aug 1990 20:05
27 lines
2024 bytes
In article <1990Aug9.174513.16437@rice.edu> preston@titan.rice.edu (Preston Briggs) writes:
>(Apparently, in the case of C, the optimizer is allowed to
>do anything, since expressions with side effects are undefined(!).
>Remember that "undefined" means the optimizer may fork a game of
>chess if it cares to.).

Huh?  Do you know C?   Of course expressions with side-effects are
defined.  Where there is *more than one* side effect, the rules are a
little loose on which side effect gets evaluated first.  Not unclear,
but clearly undefined.  However, there are many situations where the
order of side effects *is* defined: for example, all side-effects in
arguments to a function are finished before the function is called.
However, if you say something like (a[i++] = i), the order of
evaluation can change. The compiler may index a with i, add one to i,
and then assign the new i to a[i]; or it may index a with i, add one to
i, and then assign the old i to a[i]; depending on registers available,
optimizations, and so on. Changing a value and using it in the same
expression (except for some very explicit operators) has always been a
no-no in C.  Such expressions have always been illegal; sadly, most
compilers don't seem to bother to check for illegal programs if they
can compile them into *something*.  I don't know: does lint?

(Also, I don't think there is much use in forking a chess game, either
in the optimizer *or* in the optimized code. "Undefined" does not mean
"silly" :-).

			  -- Darren
Technical Details
Message-ID: <27038@nigel.ee.udel.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!rex!wuarchive!udel!ee.udel.edu
References: <1990Aug2.170110.28208@rice.edu> <H925S0B@xds13.ferranti.com> <1990Aug9.174513.16437@rice.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!rex!wuarchive!udel!ee.udel.edu
From: new@ee.udel.edu (Darren New)
Newsgroups: comp.lang.misc
Subject: Re: := versus ==
Message-ID: <27038@nigel.ee.udel.edu>
Date: 9 Aug 90 20:05:20 GMT
References: <1990Aug2.170110.28208@rice.edu> <H925S0B@xds13.ferranti.com> <1990Aug9.174513.16437@rice.edu>
Sender: usenet@ee.udel.edu
Organization: University of Delaware
Lines: 27
Nntp-Posting-Host: estelle.ee.udel.edu