'int' is enough for 'length' to migrate code from x86 to x64
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 25 07:52:20 PST 2014
On Tuesday, 25 November 2014 at 15:42:13 UTC, Kagamin wrote:
> Correctness is an emergent property - when behavior matches
> expectation, so overflow has variable correctness in various
> parts of the code.
I assume you are basically saying that Walter's view that
matching C++ is more important than getting it right, because
some people might expect C++ behaviour. Yet Ada chose a different
path and is considered a better language with respect to
correctness.
I think it is important to get the definitions consistent and
sound so they are easy to reason about, both for users and
implementors. So one should choose whether the type is primarily
monotonic, with incorrect values "truncated into" modulo N, or if
the type is primarily modular.
If addition is defined to be primarily monotonic it means you can
optimize "if(x < x+1)…" into "if (true)…". If it is defined to be
primarily modular, then you cannot.
More information about the Digitalmars-d
mailing list