Paul Schlie wrote:
From: Robert Dewar <[EMAIL PROTECTED]>
You keep saying this over and over, but it does not make it true. Once
again, the whole idea of making certain constructs undefined, is to
ensure that efficient code can be generated for well defined constructs.


- Can you give an example of an operation which may yield an undefined
  non-deterministic result which is reliably useful for anything?

The simplest example is a shift operation, x << n, where the compiler may assume that the shift count is smaller than the width of the type. All sane machines agree on shift behaviour for 0 <= n < width, but there are differences between machines for n >= width. Since this case is undefined by the language, it is ensured that shifts take only a single instruction on essentially all machines.


Bernd

Reply via email to