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

S1905: fix false positive with "typedef"

    XMLWordPrintable

    Details

      Description

      Casting from an externally defined typedef to a similar type written differently shouldn't raise any issue.
      The external typedef might be platform dependent.

      // some external library
      #ifdef WIN32
      typedef long long myint;
      #endif
      #ifdef UNIX
      typedef int myint;
      #endif
      
      // user code
      void f(size) {
        int j = (int)h(); // should not raise an issue
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              geoffray.adde Geoffray Adde
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: