C Style

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jan 21 01:27:09 AEST 1989


In article <925 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
>Global functions are prefixed with a 3 letter & underscore prefix, the
>3 letters identifying the module.

Four of the six guaranteed significant characters seems like too
great a price.  We use 2-character "package prefixes"; e.g.
	MmAllo
where "Mm" denotes the "Memory manager" package and "Allo" is of
course the specific function of "Allocation".  This has worked
well for me over the decades.

>The header file that exports the module's global functions, variables,
>types & macros (and is included by the module itself and all others
>that use the module) defines the symbol QUE to prevent multiple inclusion.

Short macros like that worry me, because the probability of conflict
with some other use seems too great.  Our package interface definition
header for the "Mm" package uses the symbol MmH_INCLUDED, which is
practically certain not to clash with anybody else.



More information about the Comp.lang.c mailing list