This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada front-end depends on signed overflow
- From: Robert Dewar <dewar at adacore dot com>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Dave Korn <dave dot korn at artimi dot com>, 'Florian Weimer' <fw at deneb dot enyo dot de>, 'Andrew Pinski' <pinskia at physics dot uc dot edu>,'GCC List' <gcc at gcc dot gnu dot org>, bosch at gnat dot com
- Date: Wed, 08 Jun 2005 09:55:16 -0400
- Subject: Re: Ada front-end depends on signed overflow
- References: <BECC6F89.A6C8%schlie@comcast.net>
Paul Schlie wrote:
From: Dave Korn <dave.korn@artimi.com>
----Original Message----
From: Paul Schlie
Sent: 08 June 2005
- Can you give an example of an operation which may yield an undefined
non-deterministic result which is reliably useful for anything?
Random number generation?
randomness has nothing whatever to do with non-determinisn. They
are completely different concepts.
But there are of course many examples.
THere are many examples in concurrent programming where non-determinism
is useful, and in set programming, arbitrary non-deterministic selection
from a set is fundamental.
But this is a complete red herring in this discussion
The reason that for example in Ada we say that
a+b means non-determinisitically either compute a then b, or
b then a, is not that it is useful for these results to be
different, but precisely because we expect NO reasonable
program to ever write an expression a+b in which the two
semantic meanings that are possible are different, and
we want the compiler to take advantage of this to generate
better code.
For example
a + f(b)
we typically expect f(b) to be called first, even though
formally it might be the case that f(b) modifies a, so
this choice could have some effect from the formal
non-determinism of the semantics. Our actual attitude
is that if anyone writes code like this in which f(b)
modifies a, they are highly incompetent and we don't
care what happens.