On 07/22/14 17:31, via Digitalmars-d wrote:
> On Tuesday, 22 July 2014 at 11:40:08 UTC, Artur Skawina via Digitalmars-d 
> wrote:
>> obey the exact same rules as RT. Would you really like to use a language
>> in which 'enum x = (a+b)/2;' and 'immutable x = (a+b)/2;' results in
>> different values?...
> 
> With the exception of hash-functions the result will be wrong if you don't 
> predict that the value is wrapping. If you do, I think you should make the 
> masking explicit e.g. specifying '(a+b)&0xffffffff' or something similar, 
> which the optimizer can reduce to a single addition.

D is defined as it is, with wrapping two's complement integer arithmetic
and defined integer sizes.

My point is that the language must be consistent; adding special
cases would create a language in which one expression yields several
different results, depending on evaluation context. That would be a
very significant regression, and would severely cripple the language.
Maybe the harm done by that particular pull request wouldn't be
catastrophic, but it would be a step in a very dangerous direction.

artur

Reply via email to