Skip to content

Feature request: SafeInt and abs() #95

Description

@MartinNFuller

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions