Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-3051

S873: Allow bit field operations for enums

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.18
    • Fix Version/s: 6.29
    • Component/s: C, C++, Rules
    • Labels:
      None

      Description

      Currently, this rule is very verbose, and most findings are related to bitfield operations performed on enums. |, &, |=, &=, (maybe more surprisingly) <<.

      Maybe we should allow them unconditionally, or at least allow them as soon as some enumerators had a non default initializer?

      Or maybe we should remain strict, but then suggests the user that he should define overloaded operators to perform these operations? => In some cases, you want the result of this combination to be an int, so you don't need a user-defined operator

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              frederic.tingaud Frédéric Tingaud
              Reporter:
              loic.joly Loïc Joly
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: