On Friday, 29 March 2013 at 05:34:07 UTC, Kagamin wrote:
On Friday, 29 March 2013 at 01:18:03 UTC, Jonathan M Davis
wrote:
On Thursday, March 28, 2013 15:11:02 H. S. Teoh wrote:
Maybe it's time to introduce cast(signed) or cast(unsigned)
to the
language, as bearophile suggests?
It's not terribly pretty, but you can always do this
auto foo = cast(Unsigned!(typeof(var))var;
or
auto bar = to!(Unsigned!(typeof(var)))(var);
- Jonathan M Davis
short signed(ushort n){ return cast(short)n; }
int signed(uint n){ return cast(int)n; }
long signed(ulong n){ return cast(long)n; }
int n = va_arg!uint(_argptr).signed;
BTW phobos already has the function:
http://dlang.org/phobos/std_traits.html#.unsigned
I'm not sure if it's enough without `signed` counterpart.