Why is int implicitly convertible to ulong?

Hannes Steffenhagen cubicentertain at gmail.com
Fri Feb 21 04:41:07 PST 2014


The specific problem here was when working with std.json.

std.json distinguishes between UINTEGER and INTEGER, so I had 
code like

static if(is(T : ulong)) {
     // must be UINTEGER
} else static if(is(T : long)) {
     // can be either INTEGER or UINTEGER
}


I've since found out about isSigned and isUnsigned, still it was 
mighty confusing for me that the first case was selected for 
signed types.


More information about the Digitalmars-d mailing list