Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8244496

Add utilities to check for arithmetic overflow and underflow

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • 15
    • hotspot

    Description

      Checking for overflow or underflow of some arithmetic operation is a problem that arises in various contexts. It can be somewhat tricky to write such tests though. Depending on the operation and the types involved, naive approaches may involve undefined behavior which the compiler may recognize and "optimize" in a way that defeats the purpose of the calculation.

      Some carefully developed utilities for such operations would be helpful, both by having a single place for the possibly convoluted code, and providing meaningful names to hide that code behind.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: