HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
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);
This warning can be suppressed by adding an extra cast:
fread((char*)(void*)ai, sizeof(char), 1, stdin); // OK
Another +wendian warning captures cases where a cast when later dereferenced can
cause endian issues.
Preprocessor Options
The following options are accepted by the preprocessor:
-C
-C
Using the -C option prevents the preprocessor from stripping comments. See the
description of cpp in the cpp(1) manpage for details.
-dM
-dM
When -dM is present, instead of normal preprocessor output the compiler lists the
#define directives it encounters as it preprocesses the file, thus providing a list of all
macros that are in effect at the start of the compilation. The -dM option requires that -P
or -E also be specified.
A common use of this option is to determine the compiler's predefined macros. For
example:
touch foo.c ; cc -E -dM foo.c
-Dname
-Dname[=def]
name is the symbol name that is defined for the preprocessor.
def is the definition of the symbol name (name).
The -Dname option defines a symbol name (name) to the preprocessor, as if defined by
the preprocessing directive#define.
Preprocessor Options 87