accessForwarded
Access of forwarded variable
C and C++ are really performant languages and can be very error-prone. We all had core dumps and made pointer arithmetic errors! Thankfully, Codiga has hundreds of static analysis rules to flag potential errors in your C/C++ code, automate code reviews and merge with confidence.
Access of forwarded variable
Access of moved variable.
Obsolete function 'alloca' called. In C99 and later it is recommended to use a variable length array instead.
Avoid arithmetic operation on void pointers
Array accessed out of bounds
Array access out of bounds with a conditions
Access array beyond boundaries
Obsolete function 'asctime_s' called. It is recommended to use 'strftime' instead.
Obsolete function 'std::asctime' called. It is recommended to use 'strftime' instead.
Assert statement calls a function which may have desired side effects: 'IsAddressInSegment'.
Boolean value assigned to floating point variable.
Boolean value assigned to pointer.
Mismatching assignment and comparison
Assigning a pointer to an integer is not portable.
Assert statement modifies variable
Assigning an integer to a pointer is not portable.
Address of local auto-variable assigned to a function parameter.
Deallocation of an global variable results in undefined behaviour.
Bad usage of bitmap operator
Buffer is accessed out of bounds: Ltrans[temp].addr
Returning an address value in a function with integer return type is not portable.
Returning an integer in a function with pointer return type is not portable.
Exception should be caught by reference.
Char literal compared with pointer.
Storing getchar() return value in char variable and then comparing with EOF.
Clarify calculation precedence for '+' and '?'.
Suspicious condition (bitwise operator + comparison)
Misuse of ++ operator
Code not handled
Comparison of a boolean expression with an integer other than 0 or 1.
Subtracting pointers that point to different objects
Detect conditions that are always true
Comparison of a boolean value using relational operator (e.g. < ,>, etc)
Skipping configuration 'RLIMIT\_AS;RLIMIT\_CPU;RLIMIT\_DATA;RLIMIT\_NPROC;RLIMIT\_VMEM' since the value of 'RLIMIT\_NPROC' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
Argument 'false&&static\_cast<bool>(!!(desc.version()==100))' to function isTrue is always 0
Parameter can be declared with const
Parameter can be declared with const.
Detect unused variables
Detect variables that could be const
Access container out of bounds
Out of bounds access of variable
Value of pointer 'count'
Invalid usage of output stream: '<< std::cout'.
C-style pointer casting
Detect array access out of bounds
Null pointer dereference: base
Pointer arithmetic overflow
Using argument that is uninitialized
Non-local variable use pointer to local variable
Using object to temporary.
Using reference to dangling temporary.
Returning/dereferencing value after it is deallocated / released
Dereferencing variable after it is deallocated / released
Possible dereference of an invalid iterator
Condition is redundant or value is derefenced
Memory freed twice
Duplicate assign expression
Consecutive return
Detect duplicate conditions
Duplicate conditions
Duplicate expressions
Duplicate Ternary operator
Duplicate ternary value
Duplicated inherited member
Value used after being erased
Rethrowing exception in an exception
Catching exception in destructor
fflush() called on input stream may result in undefined behaviour on non-linux systems
Float conversation overflow
Function not called with the right arguments
Obsolute function gets() called
Virtual function is a public in a base class and became not-public in derived. It's violate a substitutability a principle in OOP.
Identical condition and return expression
Identical inner 'return' condition is always true.
Return value not used
Conversion of char literal to bool always evaluates to true.
Logical conjunction always evaluates to false
Incorrect string boolean operator
Integer overflow
Integer overflow with condition
Invalid container
Calling 'erase' while iterating the container is invalid.
Invalid function argument
Invalid boolean argument
Invalid string argument
Format string conversion error
Invalid use of scope/variable lifetime
Invalid pointer cast
Invalid formatter for float
Invalid formatter for int
Invalid formatter for signed int
Invalid formatter for string
Invalid formatter for signed long long
Invalid formatter for unsigned int
Invalid scanf
Invalid scanf for float
Invalid scanf for int
Invalid scanf for string
scanf call overwrite the memory allocated for the string
Invalid test for overflow
I/O operations without positioning
Same iterator is used with different scopes
Argument value is always known, could use a const
Condition value is always known
Container is always empty
Iterating over a container that is always empty.
Allocation failed
return value of function not stored
Direct string comparison. Compare with strcmp() instead
The lock is ineffective because the mutex is locked at the same scope as the mutex itself.
Memory leak: table.array
Common realloc mistake: value nulled but not freed upon failure
Using memset() on union which contains a floating point number.
Invalid memset assignment
memset() called to fill 0 bytes.
Mismatching allocation and deallocation
Iterators to containers from different expressions
Function overrides a function in a base class but is not marked with a 'override' specifier.
Modulo of one is always equal to zero
Expression is always false because 'else if' condition matches previous condition
Using NaN/Inf in a computation.
Negative container index
Negative index access
Class does not have a constructor although it has private member variables.
Class does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s).
Class does not have a destructor which is recommended since it has dynamic memory/resource allocation(s).
Class has a constructor with 1 argument that is not explicit.
Class does not have a operator= which is recommended since it has dynamic memory/resource allocation(s).
Possible null pointer dereference
Overflow in pointer arithmetic
Either the condition is redundant or there is overflow in pointer subtraction.
Either the condition is redundant or there is possible null pointer dereference
The address of local variable might be accessed at non-zero index.
Invalid equal operator
No 'return' statement in non-void function causes undefined behavior.
operator=' should return reference to 'this' instance.
operator=' should check for assignment to self to avoid problems with dynamic memory.
Member variable is not assigned a value
Opposite expression on both sides of expression
Opposite inner 'return' condition leads to a dead code block.
Function parameter should be passed by const reference.
Converting pointer arithmetic result to bool. The bool is always true unless there is undefined behaviour.
A pointer can not be negative so it is either pointless or an error to check if it is.
Undefined behaviour
A pointer can not be negative so it is either pointless or an error to check if it is not.
Size of pointer used instead of size of its data.
Prefer prefix ++/-- operators for non-primitive types.
Possible leak in public function.
Read operation on a file that was opened only for writing.
Variable is reassigned a value before the old one has been used
Variable is reassigned a value before the old one has been used.
Redundant condition
Redundant checking of STL container element existence before removing it.
Redundant initialization. The initialized value is overwritten before it is read.
Redundant pointer operation on 'CB' - it's already a pointer.
Resource leak
Returning pointer to local variable that will be invalid when returning.
Non-boolean value returned from function returning bool
Reference to local variable returned.
Reference to temporary returned.
Same iterators expression are used for algorithm.
Repositioning operation performed on a file opened in append mode has no effect.
Redundant assignment of variable to itself.
Member variable is initialized by itself.
Local variable shadows outer argument
Local variable shadows outer function
Local variable shadows outer variable
Local variable shadows outer variable
Shifting by a negative value is undefined behaviour
Shifting a negative value is technically undefined behaviour
Shifting 64-bit value by 64 bits is undefined behaviour.
Shifting signed 32-bit value by 31 bits is implementation-defined behaviour.
Expression can have a negative value. That is converted to an unsigned value and used in an unsigned calculation.
Conversion between unsigned and signed values
Calculation inside sizeof().
Division by result of sizeof(). memset() expects a size in bytes
Found function call inside sizeof().
Behaviour of 'sizeof(void)' is not covered by the ISO C standard.
Suspicious usage of 'sizeof' with a numeric constant as parameter.
Using 'sizeof' on array given as function argument returns size of a pointer.
Undefined behavior: Variable is used as parameter and destination in sprintf().
Unnecessary comparison of static strings.
Dangerous usage of c_str(). The value returned by c_str() is invalid after this call.
Passing the result of c_str() to a function that takes std::string as argument no. 1 is slow and redundant.
Returning the result of c_str() in a function that returns std::string is slow and redundant.
Searching before insertion is not necessary.
Suspicious condition. The result of find() is an iterator
Inefficient usage of string::find() in condition; string::starts_with() could be faster.
Missing bounds check for extra iterator increment in loop.
Out of bounds acess to a container
Modifying string literal directly or indirectly is undefined behaviour.
Unusual pointer arithmetic.
Template recursion threshold reached
Suspicious pointer subtraction.
Exception thrown in function declared not to throw exceptions.
int result is assigned to long variable. If the variable is long to avoid loss of information
int result is returned as long value. If the return value is long to avoid loss of information
Detect variables that are not assigned (e.g. dead code)
Memory is allocated but not initialized
Member variable not initialized in the constructor.
Member private variable is not initialized in the constructor.
Uninitialized struct member
Uninitialized variable
Expression can be replaced to avoid loss of precision.
Statements following return ; dead code
Class is unsafe
Public interface is not safe.
Checking if unsigned expression is less than zero.
Unsigned expression can't be negative so it is unnecessary to test it.
Variable is allocated memory that is never used.
Label is not used.
Label is not used, a pre-processor configuration prevents it to be shown.
Label is not used.
Unused label in switch
Unused private function
Instance of object is destroyed immediately.
struct member is never used.
Unused variable
Used file that is not opened.
Variable is assigned in constructor body. Consider performing initialization in initialization list.
Assignment of function parameter has no effect outside the function.
Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
Ineffective call of function 'empty()'. Call 'clear()' instead.
Return value ignored. Elements remain in container.
Ineffective call of function 'substr' because it returns a copy of the object. Use operator= instead.
Consider using std::generate algorithm instead of a raw loop.
va\_list 'argument\_list' was opened but not closed by va\_end().
va\_list 'cpy' used before va\_start() was called.
va\_start() or va\_copy() called subsequently on 'argptr' without va\_end() in between.
Passing NULL after the last typed argument to a variadic function leads to undefined behaviour.
Dynamic binding is not used.
Class which is inherited does not have a virtual destructor.
Write operation on a file that was opened only for reading.
mismatch printf parameters
printf: invalid parameter position
Division by zero.
Either the condition is redundant or there is division by zero
Undefined behaviour, when 'len' is 4 the pointer arithmetic 'cmd+len' is out of bounds
Mismatching bitmasks.
Comparison of a variable having boolean value using relational (<, >, <= or >=) operator
The one definition rule is violated, different classes/structs have the same name.
Member variable not initialized in constructor
Uninitialized variable
Missing return statement
Using std::move for returning object by-value from function will affect copy elision optimization
Overlapping read/write of union is undefined behavior
Buffer is too small
Non-standard character literal
Iterators of different containers are used together.
Rethrowing current exception
operator should either return reference to 'this' instance or be declared private and left unimplemented.
Wrong parameter for va_start()
Call of pure virtual function in constructor.