Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upint::abs should return an unsigned int #2353
Comments
This comment has been minimized.
This comment has been minimized.
|
I am not sure if this makes sense. I imagine a common use of I imagine it is actually very unusual to have code where you have an int which could be negative and you need to supply that int to a uint context such that if the int is negative you want the absolute value. I could imagine something like |
catamorphism
closed this
May 17, 2012
This comment has been minimized.
This comment has been minimized.
|
I'll take your word for it. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
catamorphism commentedMay 4, 2012
Currently,
int::abshas a return type that's the same as its arg type, and writingint::abs(x) as uintlooks very silly. I understand that it's not totally straightforward to write what we really want (basically, we want a type function that relates an int type of a given size to a uint type of a given size, and AFAICT we can't do that), but it would still be good. Maybe there's a clever workaround I'm not seeing...