digitalmars.D.learn - Question about Phobos library file ("ti_uint.d")
- Marcio Faustino (8/8) Jan 13 2007 Hi everyone,
-
Stewart Gordon
(5/13)
Jan 13 2007
- Marcio Faustino (2/5) Jan 13 2007 Right, because of the int.max limit. Thanks.
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;
}
as the same method of the class TypeInfo_h (in file
"src/phobos/std/typeinfo/ti_ubyte.d")?
Jan 13 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.
Jan 13 2007
Stewart Gordon wrote:Because that would screw up if the difference between the two uints is greater than 2147483647. Stewart.Right, because of the int.max limit. Thanks.
Jan 13 2007








Marcio Faustino <m.faustino.remove-this gmail.com>