HP Code Advisor Diagnostics Reference Guide (5900-1865, July 2011)

return 1;
}
Action:
Cast (or otherwise rewrite) one of the operands of the compare to match the signedness of the
other operand, or compare for equality with zero.
Reference:
2.121 4255 padding size of struct %sq1 with %s2 bytes to alignment
boundary
Cause:
Padding bytes have been inserted for proper alignment of the struct.
Example:
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
int main() {
struct X {
uint32_t data_size;
uint8_t status;
};
}
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)
2.122 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:
2.123 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;
2.121 4255 padding size of struct %sq1 with %s2 bytes to alignment boundary 59