HP aC++/HP C A.06.25 Programmer's Guide
+wdriver
The +wdriver option enables warnings for PA-RISC options that would otherwise be
ignored silently on Integrity servers. With the addition of this option in version A.06.05,
a number of warnings for PA options that had been reported by previous compiler
versions were changed to be silently ignored by default. The intent is to give good
PA-RISC to Integrity makefile compatibility by default, but provide this option to help
users clean up unnecessary or misleading use of legacy options when desired.
+wendian
This option allows the user to identify areas in their source code that might have porting
issues when going between little-endian and big-endian.
+wendian will warn of a de-reference that could cause endian-dependent behavior:
char charVal = *(char *) int_ptr;
short shortVal = ((short *) long_ptr)[0];
This warning can be suppressed by adding an extra cast:
char charVal = *(char *) (void *)int_ptr; // OK
+wendian warns that the initialization which may be endian-dependent, such as using
hex constants to init byte arrays:
char a[4] = { 0x11, 0x22, 0x33, 0x44 };
char b[4] = { 'a', 'b', 'c', 'd'}; // OK
This warning can be suppressed by not using a hex/octal constant:
char a[4] = { 17, 0x22, 0x33, 0x44 }; // OK
+wendian also warns of unions that make assumptions about data layout:
union u1 {
char c[4];
int v; };
union u2 {
long long ll;
short s[4];
char c[8]; };
This warning can be suppressed by adding a dummy member:
union u1 { // OK
char c[4];
int v;
char dummy; };
Another type of warning is on the use of IO functions that read/write persistent data
from files that may be endian-dependent:
read(0, &i, sizeof(i));
fread(&ai[0], sizeof(int), elems_of(ai, int), stdin);
write(1, &i, sizeof(i));
fwrite(&ai[0], sizeof(int), elems_of(ai, int), stdout);
96 Command-Line Options