Presence of #line directives may cause some diagnostic messages to have incorrect file name and line number. The 'Thread' object is created but is not started. V1088. Nonsensical comparison of two different functions' addresses. It is possible that these are misprints and 'default:' label should be used instead. V620. Remember that 'a == b == c' is not equal to 'a == b && b == c'. V2581. Function marked as 'noreturn' may return control. V681. Connect and share knowledge within a single location that is structured and easy to search. If no value is provided, the compiler will produce a syntax error. The return value of the function should probably be compared with std::string::npos. External identifiers should be distinct. V5002. V3167. Check lines: N1, N2. V584. AUTOSAR. The resulting value is meaningless and should not be used. V2579. MISRA. V621. It is probably unused, uninitialized, or already locked. Consider implementing event accessors explicitly or use 'sealed' keyword. V696. V6017. It will be closed before the method exits. The object is already of the same type. If certain compiler flags are passed, this type of error or warning might get suppressed entirely, which will lead to run-time faults if the given function gets called in the program. How do I count the number of sentences in C using ". V669. A bool type variable is incremented. The resulting value could be inaccurate. Variable should be declared in a scope that minimizes its visibility. Non-void functions always have to have a return statement. Find centralized, trusted content and collaborate around the technologies you use most. When compiling the above example, your compiler may issue a warning about line 9 being unreachable. : **non void function does not return a value in all control paths: **. Pointer was used before its check for nullptr. If function ends without return (or throw), then the behaviour of the program will be undefined. Check for missing parentheses or use the '&&' or '||' operator. V3036. Use 'memmove' function. V6018. Function result is saved inside the 'byte' type variable. Flexible array members should not be declared. V1050. V505. AUTOSAR. Suspicious pointer arithmetic with 'malloc/new'. Functions' declarations with 'Foo' name differ in 'const' keyword only, while these functions' bodies have different composition. V3044. V3084. V1073. Such absolute value can't be represented in two's complement. The argument of the method is not expected to be null. V821. The function located to the right of the '|' and '&' operators will be called regardless of the value of the left operand. Variable length array types are not allowed. N operand of '? MISRA. A function name may be missing. Connect and share knowledge within a single location that is structured and easy to search. Consider inspecting the condition. As your code stands, if candidate_count is greater than 0 the loop will iterate once and then unconditionally return false, which I don't think is what you want. V2545. The variable can be constructed in a lower level scope. The value should be non-negative. Abnormality within similar comparisons. The variable is not used after copying. Dangerous explicit type pointer conversion. V6039. V542. Use 'double.IsNaN()' method instead. V2531. The 'A' class contains 'Dispose' method. V3542. V805. V6029. V2569. Returning a value from a void function is a compile error. The operator evaluates both operands. error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]} bool is_full() { if() { return 1; } else if() { return 0; } else if() { return 1; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 : N argument has memsize type. It is possible that macro expansion resulted in incorrect evaluation order. V6066. Call of function 'foo' with variable number of arguments. The expression is excessive or contains a logical error. It is more efficient to catch exception by reference rather than by value. OWASP. Potential logical error is present. It calls strlen once and either jumps to .L1 or falls through to the then code, which rejoins at .L1. Bit fields should only be declared with explicitly signed or unsigned integer type. After each of these function calls, execution continues at the next statement. V2574. A return statement can return a value to the calling function. Consider declaring it as a reference. V2559. V3103. The field (property) is used before it is initialized in constructor. V591. The expression is excessive or contains a misprint. V2527. Function receives an odd argument. Consider enabling the display of invisible characters in the code editor. AUTOSAR. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. V3514. V2520. Thus, the warning is a very useful one and you should consider yourself lucky that the compiler noticed the bug. The report_ratio function has a void return type, so it doesn't need to explicitly return a value. Stack of original exception could be lost. V1062. Consider inspecting the loop expression. For more information, see "Behavior" in Function Statement. Expression was implicitly cast from integer type to real type. Return value of 'Foo' function is required to be used. V3547. Memory allocation and deallocation functions should not be used. It is highly probable that the semicolon ';' is missing after 'return' keyword. V6048. V3006. Function body contains the 'X' label that is not used by any 'goto' statements. The return statement may or may not return anything for a void function, but for a non-void function, a return value must be returned. If expression is omitted, the return value of the function is undefined. OWASP. It means that there is no default return value for your function outside of the for loop. AUTOSAR. operator should have 'bool' type. Exception classes should be publicly accessible. Calling method or accessing property of potentially disposed object may result in exception. Pointer was used in the logical expression before its check for nullptr in the same logical expression. Modified value of the operand is not used after the increment/decrement operation. V2616. You signed in with another tab or window. Assigning the value C to the X variable looks suspicious. :' operator has a lower priority than the 'foo' operator. Conditional expressions of 'if' statements located next to each other are identical. V6097. The expression is incorrect or it can be simplified. To determine the length of a string by 'strlen' function correctly, use a string ending with a null terminator in the first place. MISRA. V563. Call of the 'Foo' function will lead to buffer overflow. The compiler isn't going to go to very much trouble to detect this situation, because functions like throw_blah which are guaranteed to never return are rare, and because except in the simplest of situations, there's no way for it to reliably do so. V816. V562. Inline functions should be declared with the static storage class. Potentially unsafe double-checked locking. V012. V6051. Use of two opposite conditions. V5010. Potentially tainted data is used in the URL. The 'throw' keyword could be missing. The expression of 'foo(foo(x))' pattern is excessive or contains an error. V001. What is the Russian word for the color "teal"? Getting "non-void function does not return a value in all control paths", New blog post from our CEO Prashanth: Community is the future of AI, Improving the copy in the close modal and post notices - 2023 edition, Embedded hyperlinks in a thesis or research paper. Currently your code is returning the vector based on conditions. The operation is executed 2 or more times in succession. A value is being subtracted from the unsigned variable. Consider inspecting 'X'. The 'A' field should probably be returned/assigned instead. The variable is assigned but is not used by the end of the function. NullReferenceException is possible. V577. V3120. The expression of the 'char' type is passed as an argument of the 'A' type whereas similar overload with the string parameter exists. V2002. Function receives an address of a 'char' type variable instead of pointer to a buffer. The object was used before it was verified against null. The result will always be zero. The SUCCEEDED or FAILED macro should be used instead. nlohmann/json.hpp:20017:5: warning: non-void function does not return a value in all control paths [-Wreturn-type] reference operator[](T* key) nlohmann/json.hpp:20925:5: warning: non-void function does not return a value in all control paths [-Wreturn-type] For more information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic. An item with the same key has already been added. V3095. V011. When main calls printHi, the code in printHi executes, and Hi is printed. V3537. Review captured variable in lambda expression. There are two 'if' statements with identical conditional expressions. Variable is of enum type. V2532. V2528. Multiple copies of it will be created in all translation units that include this header file. MISRA. Passing these values into the method will result in an exception. V516. MISRA. An identifier with array type passed as a function argument should not decay to a pointer. Potentially tainted data might be used to execute a malicious script. Be advised that the size of the type 'long' varies between LLP64/LP64 data models. To learn more, see our tips on writing great answers. TYPE X[][] is not equivalent to TYPE **X. MISRA. Explicit conversion from 'float/double' type to unsigned integer type. V691. Consider making the project fully compilable and building it before analysis. The 'ThreadStatic' attribute is applied to a non-static 'A' field and will be ignored. Conversions between pointers to objects and integer types should not be performed. Explicit conversion from 'void *' to 'int *'. Was Aristarchus the first to propose heliocentrism? V6052. Your function should return a vector in every possible condition. V6065. The variable was used to initialize itself. 565), Improving the copy in the close modal and post notices - 2023 edition, New blog post from our CEO Prashanth: Community is the future of AI. I forgot it would still issue if all paths don't have a return. V717. V501. Awaiting on expression with potential null value can lead to throwing of 'NullReferenceException'. V3148. V6078. This recommendation encompasses ERR33-C. Detect and handle standard library errors. V3546. Executing this query may lead to an error. Are there any canonical examples of the Prime Directive being broken that aren't shown on screen? V3081. AUTOSAR. Flowing off the end of a non-void function with no 'return' results in undefined behavior. The switch statement does not cover all values of the enum. Non-void functions are required to have a return type. V836. V2611. Consider inspecting usage of 'Y' counter. V639. Non-zero value can become 'FALSE'. V3075. AUTOSAR. in your code compiler does not know if the key will not be changed in the call to strlen as you pass a pointer (side effects). Any loop should be terminated with no more than one 'break' or 'goto' statement. AUTOSAR. V2537. V6036. Incorrect shifting expression. V3119. Possible SQL injection. Using 'std::move' function's with const object disables move semantics. Can the game be left in an invalid state if all state-based actions are replaced? V753. Consider using a comparison with defined precision: fabs(A - B) < Epsilon or fabs(A - B) > Epsilon. V2599. Identifiers declared in the same scope and name space should be distinct. V2018. The value range of the variable: [A, B]. Such a pointer will become invalid. Why did US v. Assange skip the court of appeal? V3186. If the function has a void return type, this behavior is okay, but may be considered poor style. V5623. Thanks for contributing an answer to Stack Overflow! V525. A return statement ends the execution of a function, and returns control to the calling function. (This const / volatile distinction is not important.) Bool type value is compared with value of N. Consider inspecting the expression. V835. Consider inspecting the loop expression. The '? V2563. Consider using the declaration from system header files instead. Consider wrapping the throw operator in a try..catch block. Identical expression to the left and to the right of compound assignment. Unreachable code was detected. Dozens of bugs have been opened for this . MISRA. Possibly meant: 'A -= B'. Silent suppression of exceptions can hide the presence of bugs in source code during testing. AUTOSAR. Consider inspecting the expression. V1096. Suspicious code formatting. This expression can be simplified. V738. V1083. MISRA. V699. V2602. To learn more, see our tips on writing great answers. Ineffective use of the 'count' function. How to Make a Black glass pass light through it? The return value of non-void function should be used. It is odd that the body of 'Foo_1' function is fully equivalent to the body of 'Foo_2' function. V769. An exception handling block does not contain any code. It is suspicious that value 'X' is assigned to the variable 'Y' of HRESULT type. Expressions that use comma operator ',' are dangerous. Function exited without releasing the pointer/handle. MISRA. Type casting is used 2 times in a row. AUTOSAR. V002. V810. The expression is incorrect or it can be simplified. OWASP. The initial value of the index in the nested loop equals 'i'. V1085. Consider inspecting the return statement. Functions of strcmp() kind can return any values, not only -1, 0, or 1. External object or function should be declared once in one and only one file. The '&=' operation always sets a value of 'Foo' variable to zero. Structures with members of real type are compared byte-wise. Possible Zip Slip vulnerability. AUTOSAR. Can you still use Commanders Strike if the only attack available to forego is an attack against an ally? V608. Consider checking the first actual argument of the 'Foo' method. V664. Pointer to local array 'X' is stored outside the scope of this array. Buffer needs to be securely cleared on all execution paths. V762. V831. V2508. Implementation of 'compareTo' overloads the method from a base class. V3008. V3156. V2566. Possible exception when serializing type. Explicit conversion from memsize type to 32-bit integer type. Implicitly specified enumeration constants should be unique consider specifying non-unique constants explicitly. AUTOSAR. Your message has been sent. Consider inspecting the expression. The comma operator should not be used. Variable 'foo' was assigned the same value. V2014. Consider inspecting the 'for' operator. Two 'if' statements with identical conditional expressions. V537. V3139. V602. It is possible that a call to 'Start' method is missing. Consider inspecting the expression. Potentially infinite loop. This causes implementation-defined behavior. Connect and share knowledge within a single location that is structured and easy to search. Check your control flow logic and make sure you assign a value before every statement that causes a return. Potentially tainted data is used to create query. This may lead to undefined behavior. Consider replacing the call to the 'at()' method with the 'operator[]'. MISRA. V1046. V1089. It is possible that a backslash should be used instead: '\r'. V5005. If you are treating warnings as errors, you may need to temporary disable that setting in order to compile the example. V2617. If you haven't received our response, please do the following: check your Spam/Junk folder and click the V3122. Array size should be specified explicitly when array declaration uses designated initialization. Error message contains potentially sensitive data that may be exposed. A pattern was detected: A || (A && ). V2554. Possible XPath injection. V759. MISRA. Check the array initialization. V3172. Class member is initialized with dangling reference. Here is my code: why does it show compile error?? It is possible that the variable should be used instead of the string literal. MISRA. MISRA. V5607. V121. It is complaining because within the first for loop, if block returns v but else if block does not return anything. V5304. V698. V3169. Decreased performance. Potential insecure deserialization vulnerability. One of the operands in the operation equals NN. V3060. V6105. One of the function's arguments has the same name and this argument is a reference. V128. V2019. V013. The 'if' 'else if' construct should be terminated with an 'else' statement. AUTOSAR. AUTOSAR. Has the cause of a rocket failure ever been mis-identified, such that another launch failed due to the same problem?