Make some atomic operations nodiscard

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Affects Version/s: None
    • Component/s: hotspot

      It is likely/always a mistake to not use the result from various atomic operations. Annotating them as `[[nodiscard]]` would catch such mistakes.

      load_{relaxed,acquire}
      compare_exchange (nearly always, but maybe not always?)
      compare_set
      exchange

      If compare_exchange ignoring the value is rare but does occur, it could still be made nodiscard and require explicit discard in those rare cases.

      Arithmetic and bitwise logical operations should have void returning variants, with the various fetching variants made nodiscard.

      The hard part for the void variants of arithmetic and bitwise logical operations may be coming up with a satisfactory naming convention for them.

            Assignee:
            Kim Barrett
            Reporter:
            Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: