I'm getting a false positive (Unusual pointer arithmetic. A value of type 'char' is added to a string literal. [strPlusChar]) on the follwing code
void function(void) { std::string l_Test; l_Test = "FooBar"s + 'a'; }
Although “FooBar”s returns a std::string which has a valid operator+ for char
alright.. "FooBar"s is not understood by compilers by default.. I assume you have an operator for that?
"FooBar"s
it seems "s" suffix (along with others) is from the C++ standard library, see last section on https://en.cppreference.com/w/cpp/language/user_literal
yes I assume there must be an operator.
Cppcheck does not handle this code well. I created a ticket: https://trac.cppcheck.net/ticket/9787
Log in to post a comment.
I'm getting a false positive (Unusual pointer arithmetic. A value of type 'char' is added to a string literal. [strPlusChar]) on the follwing code
Although “FooBar”s returns a std::string which has a valid operator+ for char
alright..
"FooBar"s
is not understood by compilers by default.. I assume you have an operator for that?it seems "s" suffix (along with others) is from the C++ standard library, see last section on https://en.cppreference.com/w/cpp/language/user_literal
yes I assume there must be an operator.
Cppcheck does not handle this code well. I created a ticket: https://trac.cppcheck.net/ticket/9787