[Issue 18380] Integral Promotion Fix 16997 should ignore if ultimate result is cast to original or smaller type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 20 23:26:48 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18380
hsteoh at quickfur.ath.cx changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hsteoh at quickfur.ath.cx
--- Comment #1 from hsteoh at quickfur.ath.cx ---
+1000! Having to write monstrosities like `b = cast(ubyte) -cast(int) b;` is
the one thing that ticked me off enough to start a forum discussion about it.
In any case, I've written an infectious wrapper type along the lines suggested
by Luis Marques (IIRC) that hides away this insane cast-o-mania, so I could
just write `b = -b.np` (np stands for No Promote[1], ie., it just truncates)
and it will Just Work(tm) without insanity-inducing nested casts.
[1] np can also stand for "no problem", as in, I don't have to care about
squint-inducing casts anymore. :-D
--
More information about the Digitalmars-d-bugs
mailing list