Structure pointer question

Doug Gwyn gwyn at brl-smoke.ARPA
Tue Jun 21 22:36:49 AEST 1988


In article <723 at vsi.UUCP> sullivan at vsi.UUCP (Michael T Sullivan) writes:
>Note the leading underscore in the name-macro _HEADER_H.  This keeps
>your namespace from being polluted.

Be careful!  That identifier is reserved for use by the (ANSI) C
implementation and should not be used by applications.

In a large application we're currently developing, there are many
functional "packages", each of which has its own 2-letter prefix
which is used for all external identifiers in the package, as well
as all macros defined in the corresponding interface definition
header.  So, for example, our header "Dx.h" uses the name
"Dx_HDR_INCLUDED" for its one-time lockout flag.  This package
prefix scheme also addresses the problem of namespace partitioning,
and has been working out quite well.

>This type of thing sure would be handy in the Unix header files (hint, hint).

A start had already been made at doing this, and it is essential for
ANSI C conformance.  (The C implementation will have to use macro
names starting with underscore for its lockout flags.)



More information about the Comp.lang.c mailing list