HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)

Table Of Contents
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)
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:
4259 suggest parentheses around the operands of %sq 59