I would like to have a safe version of abs(). I don't know whether it should return SafeInt and throw on INT_MIN, or if it should return SafeInt and deal with overflows only when the value is used. I would like safe versions for long and long long also.
I don't know what to suggest for short and (signed) char. There is no standard library function for these types so it would be consistent with the standard library to convert the input to Safeint. On the other hand, SafeInt library doesn't follow standard integer promotion rules, so perhaps it should always return the same size as the input.
I would like to have a safe version of abs(). I don't know whether it should return SafeInt and throw on INT_MIN, or if it should return SafeInt and deal with overflows only when the value is used. I would like safe versions for long and long long also.
I don't know what to suggest for short and (signed) char. There is no standard library function for these types so it would be consistent with the standard library to convert the input to Safeint. On the other hand, SafeInt library doesn't follow standard integer promotion rules, so perhaps it should always return the same size as the input.