Menu

raw string literals producing false positives

2015-09-04
2015-09-04
  • Johann Anhofer

    Johann Anhofer - 2015-09-04

    A few samples of using raw string literals which producing cppcheck errors.

    // syntaxError: Invalid number of character (() when these macros are defined: ''.
    static const char doubleQuotes[] = R"("Hello 'world!")";

    // noQuoteCharPair: No pair for character("). Can't process file. File is either invalid or unicode, which is currently not supported.
    static const char pattern1[] = R"( { "app" : "all" ,[^"]"id" : "%1" ,[^"]"type" : "%2" ,[^"]"path" : "%3"[^}]*})";

    // syntaxError: Invalid number of character([) when these macros are defined : ''.
    static const char pattern2[]
    = R"(("path"\s:\s")[^"]*("))";

     
  • Alexander Mai

    Alexander Mai - 2015-09-04

    That seems to be fixed within the upcoming version 1.70 (within a few days). At least current git head doesn't complain about your code snippet anymore, while 1.69 does.

     

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.