HP Code Advisor Diagnostics

4259 suggest parentheses around the operands of %sq
Cause:
A possibly incorrect combination of [in]equality and bitwise operations. Passing a boolean
argument to a bit operation is quite unusual and usually happens because of programming errors
like missing parentheses around operands of "&" and "|"
Example:
return (i == j | k); // warning 4259 here
== has higher precedence than | and hence will be evaluated first, this is probably not what the programmer
intended. For j|k to be evaluated first put parentheses around j|k.
Action:
When using bit operations in combination with [in]equality, put parentheses around operands
of bitwise operators.
Reference:
4264 padding size of struct anonymous with %s bytes to alignment
boundary
Cause:
Padding bytes have been inserted for proper alignment of the anonymous struct.
Example:
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
int main() {
typedef struct {
uint32_t data_size;
uint8_t status;
} str;
}
Action:
Insertion of padding bytes themselves is not a problem but you need to ensure that you do not
use hard coded offsets for accessing fields of the struct through pointers, use offset of macro
instead. In some cases the number of padding bytes being inserted can be reduced by reordering
the fields.
Reference:
ANSI/ISO C++ 18.1(5)
4272 conversion from %t1 to %t2 may lose sign
Cause:
The Compiler has detected conversion from a signed data type to an unsigned data type. This
may lead to loss of sign.
Example:
typedef unsigned int uint32_t;
void foo(int j) {
uint32_t k;
k = j;
}
Action:
If this is intended then add a cast.
4259 suggest parentheses around the operands of %sq 63