List Info

Thread: Fix 'abs' and 'neg' overloading for 64-bit ints




Fix 'abs' and 'neg' overloading for 64-bit ints
user name
2007-10-09 09:12:23
This is my first patch for tackling the 64-bit int
overloading issues.
 It corrects the behavior of 'abs' and 'neg' (unary minus):

perl -lwe '{ package t0; sub mynum 
use overload
"0+" => &mynum, fallback => 1; } printf
"%dn", abs(t0::mynum);
printf "%dn", abs(bless({}, "t0"))'

perl -lwe '{ package t0; sub mynum 
use overload
"0+" => &mynum, fallback => 1; } printf
"%dn", -&t0::mynum; printf
"%dn", -bless({}, "t0")'

Feedback is requested (as it's possible I don't really know
what I'm doing ;).

  
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )