We know it knows for two reasons. The expression of strlen(MyStr.c_str()) kind can be rewritten as MyStr.length(). Such absolute value can't be represented in two's complement. Check for typos. It is easier to guarantee that every return from the procedure returns a value if you always use the Return statement. The expression was implicitly cast from integer type to real type. The variable of char type is compared with pointer to string. Explicit conversion from 'float/double' type to signed integer type. V3089. It is suspicious that the body of 'Foo_1' function is fully equivalent to the body of 'Foo_2' function. V578. C++ code showing Line 25: Char 5: error: non-void function does not Effect of a "bad grade" in grad school applications, Using an Ohm Meter to test for bonding of a subpanel. great work. Connect and share knowledge within a single location that is structured and easy to search. Consider checking the function for an error. Identical expression to the left and to the right of compound assignment. So it does not know if the second strlen will return the same value as the first one. Non-null function pointer is compared to null. Overflow check is incorrect. Possible command injection. Content Discovery initiative April 13 update: Related questions using a Review our technical responses for the 2023 Developer Survey, Non-void function does not return a value. Use direct analyzer integration or compiler monitoring instead. A pointer/reference parameter in a function should be declared as pointer/reference to const if the corresponding object was not modified. Your message has been sent. OWASP. The right operand is greater than or equal to the number of bits in the left operand. Check lines: N1, N2. Function with a non-void return type should return a value from all exit paths. Function body contains the 'X' label that is not used by any 'goto' statements. MISRA. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, FWIW, compiling the example code on godbolt.org with, @EricPostpischil but compiler does not know if, Yes, it does know. V6033. V3171. V655. AUTOSAR. Pattern A || (A && ) was detected. V645. V6103. Size of a pointer is divided by another value. MISRA. The passing of data to or from this function may be affected. Potential incorrect use of item 'X'. V302. Check for an error or bad coding style. Classes should always be derived from std::exception (and alike) as 'public'.