study: use checkedint as a drop-in replacement of native long

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 24 21:28:24 UTC 2021


On Wed, Mar 24, 2021 at 06:38:07PM +0000, Gregor Mückl via Digitalmars-d wrote:
> On Wednesday, 24 March 2021 at 17:38:14 UTC, H. S. Teoh wrote:
> > Since there is only one sensible meaning of `a = b = c`...
> 
> If I'm reading the spec on expressions right, the compiler is actually
> free to interpret that as (a = b) = c if it feels particularly
> adventurous. The evaluation order of assignment operations is
> explicitly undefined...

Link to spec please?  If what you say is true, that sounds like an error
in the spec.  Walter has said many times that evaluation order in D is
left to right, unless otherwise indicated. Having it unspecified just
leads to a huge can o' worms.


[...]
> Side note: having an undefined order of execution of the sides of an
> assignment can be a great source of fun (read: surprising) bugs in
> C++. Just going from GCC to clang switches the order around.

Exactly, this is why Walter is against having unspecific order of
execution.  This supposed "optimization opportunity" leads to far more
trouble than it's worth.


T

-- 
What doesn't kill me makes me stranger.


More information about the Digitalmars-d mailing list