Question about Phobos library file ("ti_uint.d")

Stewart Gordon smjg_1998 at yahoo.com
Sat Jan 13 10:20:47 PST 2007


Marcio Faustino wrote:
> Hi everyone,
> 
> Why does the method compare of the class TypeInfo_k (in file
> "src/phobos/std/typeinfo/ti_uint.d") isn't simply:
> 
> int compare(void *p1, void *p2) {
>     return *cast(uint*) p1 - *cast(uint*) p2;
> }
<snip>

Because that would screw up if the difference between the two uints is 
greater than 2147483647.

Stewart.


More information about the Digitalmars-d-learn mailing list