Menu

Possible issue with managed C++, or maybe very long typenames

2021-08-03
2021-08-04
  • John Schmitz

    John Schmitz - 2021-08-03

    We're using cppCheck for static code analysis, and are getting a few syntaxError failures. The interesting thing is that the error is reported at a point in the middle of a very long typename defined by Windows::Foundation. Most of our library uses straight standard C++14, but one platform needs to use UWP and managed code to interface with a 3rd party SDK. This call:

                                m_asyncOperation->Completed = ref new AsyncOperationWithProgressCompletedHandler< IBuffer^, unsigned int >( [this](
                                                              IAsyncOperationWithProgress< IBuffer^, unsigned int >^ asyncOp, AsyncStatus asyncStatus )
    

    causes this cppCheck error:

            <error id="syntaxError" severity="error" msg="syntax error" verbose="syntax error" file0="<redactedFile>.cpp">
                <location file="<redactedFile>.cpp" line="376" column="98"/>
            </error>
    

    Note that column 98 is right in the middle of the AsyncOperationWithProgressCompletedHandler type name.
    Update: While looking at another syntax error, I realized that I can't be sure about the column position within the line. How is the tool treating tabs?

     

    Last edit: John Schmitz 2021-08-03
  • CHR

    CHR - 2021-08-04

    As far as I know, cppcheck makes no claims of handling that sort of code (C#, C++/CX...?), so maybe you can skip analysis of those files?

     
    👍
    1

    Last edit: CHR 2021-08-04
  • Daniel Marjamäki

    yes unfortunately managed c++ is outside the scope for cppcheck.

    How is the tool treating tabs?

    a tab is treated as a single character.

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.