Names safe to use
As you can tell by now,
the rules regarding when certain names are reserved
are complicated.
There are, however,
four fairly simple rules you can follow to keep from
colliding with any ANSI C reserved names:
-
#include
all system headers at the top of your source files
(except possibly after a
#define
of
_POSIX_SOURCE
or _XOPEN_SOURCE, or both).
-
Do not define or declare any names that begin with an underscore.
-
Use an underscore or a capital letter somewhere within the first few
characters of all file scope tags and regular names.
(But beware of the
``va_''
prefix found in
stdarg.h
or
varargs.h.)
-
Use a digit or a non-capital letter somewhere within the first few
characters of all macro names.
(But note that almost all names beginning with an
E
are reserved if
errno.h
is
#included.)
As noted earlier,
most implementations will continue to add
names to the standard headers by default.
Therefore these rules are just a guideline
to follow.
Next topic:
Internationalization
Previous topic:
Names reserved for expansion
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004