V3533. It may be an error. V798. V6037. V3076. Argument of the '|' bitwise operation always contains non-zero value. Consider inspecting type casting. All analyzer messages were filtered out or marked as false positive. This is the same thing that happens at the end of the function anyway. V6038. The value of uninitialized variable should not be used. V827. V639. Suspicious return of an always empty collection. N operand of '? Suspicious sequence of assignments: A = B; B = A;. V6064. Consider inspecting usage of 'Y' counter. He also rips off an arm to use as a sword. V3116. V6078. V5605. Non-null function pointer is compared to null. Let's consider an example: Decreased performance. We discuss the debate over early returns in lesson 7.10 -- Break and continue. V302. V792. Usage of potentially invalid handle. V2616. V712. What is this brick with a round back and a stud on the side used for? Consider replacing the expression 'AA' with 'BB'. The 'a % b' expression always evaluates to 0. On 32-bit/64-bit platform, structure size can be reduced from N to K bytes by rearranging the fields according to their sizes in decreasing order. V3102. int sometimes ( int x) { if (x > 0) { return 2*x; } } MISRA. This pattern is suspicious. No locking will be performed. Unreachable code under a 'case' label. "Not Spam" button for our message. It is possible that macro expansion resulted in incorrect evaluation order. OWASP. MISRA. Two opposite conditions were encountered. Consider assigning realloc() to a temporary pointer. V2520. V5610. You may or may not use the return . Trying to use the return value from the function will most likely cause a segmentation fault. I am getting this error when trying to compile the below code. V2517. V3009. ps: thanks for the awesome library. V834. Function printHi has a void return type, meaning it doesnt return a value. The resulting value may be inaccurate. Consider inspecting the expression. V3515. Call of 'std::is_constant_evaluated' function always returns the same value. We and our partners use data for Personalised ads and content, ad and content measurement, audience insights and product development. V696. V6102. V517. V3523. This expression can be simplified. It is possible that a wrong variable is compared inside the 'for' operator. If a return type isn't specified, the C compiler assumes a default return type of int. V598. Assigning potentially negative or large value as timeout of HTTP session can lead to excessive session expiration time. V3510. The 'i' variable should probably be incremented instead of the 'n' variable. After the year 2038, the program will work incorrectly. V2579. V553. The compiler makes no such assumptions, so you need to make sure that there is a return path that will be followed if the return statement inside your loop . Variable length array types are not allowed. V3042. V6018. Thus, the analyzer will not issue a warning for the following code fragment: You can look at examples of errors detected by the V591 diagnostic. Consider inspecting the expression. The operator evaluates both operands. Unsafe double-checked locking. Consider using 'std::move' instead. IDisposable object is not disposed before method returns. V3163. V3030. Single-line comments should not end with a continuation token. Possibly an incorrect HTML. Suspicious comparison found: 'a == b == c'. std::cout), a value must be provided. OWASP. Derived class object was copied to the base class object. Compound assignment expression is used inside condition. OWASP. Generating points along line with specifying the origin of point generation in QGIS. Parameter is not utilized inside method's body. The compiler has been asked to treat warnings as errors. As a good engineering practice, always specify a return type for your functions. Consider using a comparison with defined precision: fabs(A - B) < Epsilon or fabs(A - B) > Epsilon. In lieu of a data type, void functions use the keyword "void." A void function performs a task, and then control returns back to the caller--but, it does not return a value. V3109. V1086. Size of an array is not specified. V822. V3006. A double memory deallocation will occur. V741. V2508. Continue with Recommended Cookies. V6005. Compound assignment expression 'X += X + N' is suspicious. Probably the '!='/'-='/'+=' should be used here. V772. V2578. A boy can regenerate, so demons eat him for years. V6011. The standard signal handling functions should not be used. V6046. This leads to undefined behavior. Consider inspecting the condition for mistakes. The standard signal handling functions should not be used. MISRA. Consider inspecting the loop expression. V826. Consider inspecting the statement of '*pointer++' pattern. V2503. V577. AUTOSAR. AUTOSAR. Argument is a non-constant reference. Microsoft-specific: The Microsoft C implementation returns the expression value to the process that invoked the program, such as cmd.exe. It is not recommended to return null or throw exceptions from 'ToString()' method. V5606. Flowing off the end of a non-void function with no 'return' results in undefined behavior. The signature of method 'X' does not conform to serialization requirements. Sign in to comment V6040. There should be no occurrence of undefined or critical unspecified behaviour. The 'Foo' function receives the pointer and its size as arguments. MISRA. Expressions with pointer type should not be used in the '+', '-', '+=' and '-=' operations. Odd semicolon ';' after 'if/for/while' operator. V572. V501. V697. The 'first' argument of 'Foo' function is equal to the 'second' argument. V6059. Comparison with 'double.NaN' is meaningless. Sign up for a free GitHub account to open an issue and contact its maintainers and the community. V3122. The 'if' 'else if' construct should be terminated with an 'else' statement. V3104. Use of a pointer to FILE when the associated stream has already been closed. Possible NullReferenceException. The virtual destructor is not present, although the 'Foo' class contains virtual functions. V3059. V698. Dangerous explicit type pointer conversion. V801. MISRA. Executing this query may lead to an error. The report_ratio function has a void return type, so it doesn't need to explicitly return a value. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. The 'X' variable was not initialized. V3004. V680. The result of '&' operator is always '0'. Unsafe invocation of event, NullReferenceException is possible. It is possible that these are misprints and 'default:' label should be used instead. MISRA. Decreased performance. Was Aristarchus the first to propose heliocentrism? V631. Excessive type casting: string -> char * -> string. A function name may be missing. V3512. Potentially tainted data is processed by regular expression that contains an unsafe pattern. MISRA. V3534. Constant expression in switch statement. V3133. If you have parameters instead of "void" in your function's parentheses you have to return something. V3107. Consider inspecting the expression for function call. An excessive type cast or check. V2005. This condition was already verified in previous line. Field 'A' is being used before it was initialized. Operands of the logical '&&' or the '||' operators, the '!' V548. MISRA. V6035. V2536. V1085. Probably meant: 'new type[n]'. A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. Consider specifying execution policy explicitly. It is suspicious that the BSTR data type is compared using a relational operator. V637. Non-void function must return value. "Signpost" puzzle from Tatham's collection, QGIS automatic fill of the attribute table by expression, Generating points along line with specifying the origin of point generation in QGIS. V819. Consider passing the 'Foo' argument as a pointer/reference to const. The object was created but it is not being used. This presents the compiler with a contradicting declaration and return. OWASP. Expressions that use comma operator ',' are dangerous. A non-serializable class should not be serialized. V809. V745. V642. OWASP. Variable is not used after memory is allocated for it. Possible typo in the spelling of a pre-defined macro name. There should be no implicit integral-floating conversion. V6096. The size of the dynamic array can be less than the number of elements in the initializer. Insecure XML parser is used to process potentially tainted data. Error on missing return statement under GCC. Decreased performance. V1084. It's probably an error or un-optimized code. Consider checking the N format items of the 'Foo' function. Incorrect format. Functions of strcmp() kind can return any values, not only -1, 0, or 1. Learn more about Stack Overflow the company, and our products. V584. MISRA. V6045. Consider reviewing 'X'. AUTOSAR. Initial and final values of the iterator are the same. V832. Bit fields should only be declared with explicitly signed or unsigned integer type. V2549. V3093. V574. V3522. Tag names should be unique across all name spaces. V1026. Consider replacing 'const T' with 'const .. &T' / 'const .. *T'. V2562. Functions should not be declared at block scope. The left operand of integer division is less than the right one. The '<' operator should probably be replaced with '<<'. Decreased performance. V6051. V1089. Consider checking the first actual argument of the 'Foo' function. warning: 'return' with a value, in function returning void 2. AUTOSAR. The 'delete' operator is applied to non-pointer. V3527. Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Suspicious explicit type casting. Cast should not remove 'const' qualifier from the type that is pointed to by a pointer or a reference. Expression of sizeof(T)*N kind is summed up with pointer to T type. V597. V6024. Array indexing should be the only form of pointer arithmetic and it should be applied only to objects defined as an array type. The main function calls two functions: report_square and report_ratio. The 'X' counter is not used inside a nested loop. It is odd that the body of 'Foo_1' function is fully equivalent to the body of 'Foo_2' function. V6023. Well occasionally send you account related emails. It is easier to guarantee that every return from the procedure returns a value if you always use the Return statement. The functions from time.h/ctime should not be used. Unhandled exceptions in destructor lead to termination of runtime. Perhaps, this is a typo and 'X' variable should be used instead of 'Y'. A function that does not return a value is called a non-value returning function (or a void function). Temporary anonymous object is used. One of closing ')' parentheses is probably positioned incorrectly. Perhaps, 'ThenBy' should be used instead. What were the poems other than those by Donne in the Melford Hall manuscript? That's because exit is marked as [[noreturn]]. V5006. V3052. V3101. Possible server-side request forgery. V720. The variable is incremented in the loop. Conditional expressions of 'if' statements located next to each other are identical. AUTOSAR. Classes should always be derived from std::exception (and alike) as 'public'. Consider using the declaration from system header files instead. MISRA. Stack of original exception could be lost. The 'static' keyword shall not be used between [] in the declaration of an array parameter. One of the operands in the operation equals NN. Expression resulting from the macro expansion should be surrounded by parentheses. Probably the '!=' should be used here. V664. Loop break conditions do not depend on the number of iterations. Any label should be declared in the same block as 'goto' statement or in any block enclosing it. The 'x' variable is assigned values twice successively. V3091. Possible ReDoS vulnerability. V1066. Variable should be declared in a scope that minimizes its visibility. A component of TimeSpan is used, which does not represent full time interval. Probably meant: 'CC::AA()'. Function body contains the 'X' label that is not used by any 'goto' statements. V1018. V603. Odd use of special character in regular expression. Operand that is a composite expression has more narrow essential type than the other operand. MISRA. V803. V794. Function 'Foo' writes/reads 'N' bytes. Constant expression in switch statement. use custom JSON_THROW_USER without exceptions. V2519. Don't use terminating functions in library code. Macro should not be defined with the same name as a keyword. Consider using '||' and '&&' instead. Every 'switch' statement should have a 'default' label, which, in addition to the terminating 'break' statement, should contain either a statement or a comment. V747. Expressions with enum underlying type should have values corresponding to the enumerators of the enumeration. 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). MISRA. Could a subterranean river or aquifer generate enough continuous momentum to power a waterwheel for the purpose of producing electricity? MISRA. Class initialization cycle is present. V707. V3546. The "" closing tag was encountered, while the "" tag was expected. V007. Consider inspecting the 'for' operator. Every 'switch' statement should contain non-empty switch-clauses. Such a pointer will become invalid. V3092. Different containers are used to set up initial and final values of iterator. The sizeof() operator is multiplied by sizeof(). V5608. Hi, been using 2.0.1 so far over the proposed workaround (void function instead of non-void function). V665. V3003. Expression's value is copied at the variable declaration. It is possible that there is an error. V2001. Consider inspecting 'X'. It is suspicious that the argument of sizeof() operator is the expression. The variable of char type is compared with pointer to string. V6017. Void functions cant be used in expression that require a value. The values used in expressions should have appropriate essential types. V691. The second condition is always false. It is suspicious that a char or string literal is added to a pointer. Class member is initialized with dangling reference. MISRA. When a return statement contains an expression in functions that have a void return type, the compiler generates a warning, and the expression isn't evaluated. OWASP. This may lead to undefined behavior. V769. Comparison with 'double.NaN' is meaningless. V002. Integer constant is converted to pointer. AUTOSAR. Explicit conversion from 32-bit integer type to memsize type. The '? The argument was passed to method several times. [Serializable] attribute is missing. V3545. Potentially tainted data is written into logs. An exception handling block does not contain any code. V669. V3171. The loop counter should not have floating-point type. OWASP. An item with the same key has already been added. Inspect the program's logic. V2606. Use direct analyzer integration or compiler monitoring instead. Explicit conversion from 'float/double' type to unsigned integer type. The 'if (ptr != NULL)' check can be removed. V1002. The identifier 'main' should not be used for a function other than the global function 'main'. AUTOSAR. Virtual table pointer will be damaged. operator instead. Keyword 'nullptr' can be used for 'pointer' type exception. What differentiates living as mere roommates from living in a marriage-like relationship? Possible realloc() leak: when realloc() fails to allocate memory, original pointer is lost. The variable was utilized in the logical expression before it was verified against null in the same logical expression. Unreachable code detected. Consider checking the first actual argument of the 'Foo' method. The assignment operator should be protected from the case of 'this == &src'. The 'then' statement is equivalent to the 'else' statement. One is enough. V2619. hi, at least for bool keyPressed(ofKeyEventArgs& args) it should return false as the default otherwise the event propagation will stop.. in glTypeForImageType(int imageType)I would simply add return 0; at the end of the function. V734. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Suspicious assignment inside the conditional expression of 'if/while/for' statement. Both operands of an operator should be of the same type category. You are assuming that loop will always run, but, what if an empty string ends up getting submitted? V3081. Use of jump statements in 'finally' block can lead to the loss of unhandled exceptions. ** By clicking this button you agree to our, * By clicking this button you agree to our, Free PVS-Studio license for Microsoft MVP specialists, To get the licence for your open-source project, please fill out this form. Variable is declared as auto in C. Its default type is int. What happens to the returned value, if one is specified, depends on the implementation. V773. It is more efficient to use an initialization list rather than an assignment operator. The variable in the loop exit condition does not change its value between iterations. What is scrcpy OTG mode and how does it work? Expression inside assert statement can change object's state. V3504. V3552. Why Oracle let function (basic/nopipelined) without RETURN compile, and throws error in execution. The expression is excessive or contains a misprint. V3023. Possibly 'Total*' value was intended instead. V3117. V516. Making statements based on opinion; back them up with references or personal experience. One of the function's arguments has the same name and this argument is a reference. V539. V6071. V733. So far, we never make a pedantic check with exceptions switched off. V781. The '!=' operator should probably be used here. WPF: the type registered for DependencyProperty does not correspond with the type of the property used to access it. V3035. V716. It means that there is no default return value for your function outside of the for loop. V1075. Operands of the logical '&&' or the '||' operators, the '!' V811. Features from should not be used. Find centralized, trusted content and collaborate around the technologies you use most. Incorrect format. V3146. MISRA. MISRA. Condition of a loop is always true/false. V6079. V778. If expression is omitted, the return value of the function is undefined. Buffer size is not a multiple of element size. V3186. AUTOSAR. The 'operator &&', 'operator ||', 'operator ,' and the unary 'operator &' should not be overloaded. V753. We know it knows for two reasons. Possible incorrect order of arguments passed to method. AUTOSAR. V5624. MISRA. V783. Constructor parameter is not used. V2548. Undefined behavior will occur in case of signed integer overflow. If function ends without return (or throw), then the behaviour of the program will be undefined. V5004. Is that what you want? As soon as your program hits that, it will stop executing the loop and return to the main function, performing only a single iteration of the loop. Potentially tainted data is used to create OS command. The outer type contains static field/property with identical name. Pointer is cast to a more strictly aligned pointer type. It's odd that this method always returns one and the same value of NN. V749. V791. Classes should always be derived from std::exception (and alike) as 'public'. Implicit type conversion from memsize type to 32-bit type. More info about Internet Explorer and Microsoft Edge, Compile Page, Project Designer (Visual Basic). Consider inspecting the expression. Property accessors use different backing fields. MISRA. V6003. It's probably an error or un-optimized code. Extending 'std' or 'posix' namespace may result in undefined behavior. V2594. It demonstrates the return statement, and how it's used both to end function execution, and optionally, to return a value. V3095. All I want the function to do is add one to the value of the each character inputted into the string array and shift it on the ASCII table and then return the coded message. OWASP. An item with the same key has already been added. V3519. Function with a non-void return type should return a value from all exit paths. Expression was implicitly cast from integer type to real type. V2547. OWASP. A value is being subtracted from the unsigned variable. The 'A' field should probably be returned/assigned instead. Examine the substrings "abc" and "abcd". V674. Stack of original exception could be lost. Excessive expression. Here is my code: why does it show compile error?? V806. A smart pointer may not destroy an object correctly. The behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array. V682. V774. OWASP. V6013. The code fragment is equivalent to the following: Note that undefined behavior occurs only if the end of a non-void function is actually reached. It is complaining because within the first for loop, if block returns v but else if block does not return anything. V121. If you do this, the last statement before End Function should be a Return statement. It is possible that different variables are used inside initializer and iterator. There are two 'if' statements with identical conditional expressions. Expression containing increment (++) or decrement (--) should not have other side effects. The 'X' counter is not used inside a nested loop. Pointer to FILE should not be dereferenced. Use 'memmove' function. An exception should be caught by reference rather than by value. for example: void throw_blah () { throw "blah"; } int foo () { throw_blah (); } I am pretty curious about this as this is directly related to one of my other issue . It is pointless to compute the distance between the elements of different arrays. Arguably, this is a shortcoming in the compiler. WPF: several Dependency Properties are registered with a same name within the owner type. Consider inspecting the expression. Email? V2618. V6014. AUTOSAR. Already on GitHub? V2540. Probably the '-=' should be used here. Object slicing. V693. Check the shift operator. The value range of the variable: [A, B]. V535. V2522. V683. Consider inspecting the loop expression. V6047. V505. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. V589. The function with the 'atof/atoi/atol/atoll' name should not be used. Parameter of 'std::stop_token' type is not used inside function's body. OWASP. The 'GetObjectData' implementation in unsealed type is not virtual, incorrect serialization of derived type is possible. Function receives suspicious argument. There is an easy solution to the problem, even if we understand that every condition is covered we should add a return statement at the end of the function so the compiler is sure that the non-void function will be returning some value. OWASP. V581. The switch statement does not cover all values of the enum. This is unexpected behavior. Value of a composite expression should not be cast to a different essential type category or a wider essential type. V3516. V3112. Not all members of a class are initialized inside the constructor. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. The 'A' class containing IDisposable members does not itself implement IDisposable. There should be no attempt to write to a stream that has been opened for reading.

Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0