
On Fri, Jun 18, 2010 at 8:34 AM, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 06/16/2010 09:32 PM, Scott McMurray wrote:
Can anyone think of a potential reason for options C or D? Or a reason to prefer option B? Or maybe come up with a different idea entirely?
How about this combo of B, C, and D: - if !i, --i and i-- both throw exceptions. - a - b doesn't compile for non-fixed length - provide a separate absdiff(a, b) function
Working on this option now. After looking at it, removing the binary operator- seems rather harsh... if you know that a number is larger than what you're subtracting from it, it would just be irritating. But I'll definitely add the absdiff function (maybe named "difference"?), then the developer using the library can decide which to use for himself.
Why not just go the simple route and define it as "undefined behaviour", then just pretend they will never get a negative number and let your math functions choke on it as they wish, making invalid values, dividing by zero, whatever, it is "undefined behaviour" after all.