Reserved names in ANSI C

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Jun 22 07:11:59 AEST 1989


In article <1989Jun21.090428.9636 at twwells.com> bill at twwells.com (T. William Wells) writes:
>	E[0-9A-Z].*     macros in errno.h
>	is[a-z].*       externals, ctype.h
>	to[a-z].*       externals, ctype.h
>	LC_[A-Z].*      macros in locale.h
>	<func>f         <func> is any function defined in math.h
>	<func>l         <func> is any function defined in math.h
>	SIG[A-Z].*      macros in signal.h
>	SIG_[A-Z].*     macros in signal.h
>	str[a-z].*      externals, stdlib.h and string.h
>	mem[a-z].*      externals, string.h
>	wcs[a-z].*      externals, string.h

The E* names are reserved only if <errno.h> is included.  Similarly,
the LC_* names are reserved only if <locale.h> is included, and SIG*
names are reserved only if <signal.h> is included.  The function
names mentioned are (of necessity) reserved whether or not headers
are included.

>No doubt there are others scattered throughout the spec, but I
>haven't the will to go hunting for them.

No doubt?  Section 4.1.2.1 covers this issue; it mentions the 4.13
sections, _* names, etc.  "No other identifiers are reserved."

>Can you say "name space pollution"?

X3J11 didn't cause C name space pollution; to the contrary, it has
finally been brought under control.  The majority of the above name
classes were already "polluted" by existing practice, so they were
identified and the existing practice allowed to continue but within
the newly established limits.  Certainly, application developers
need to know these limits so they can stay on the other side of the
fence.  At least they have now been allowed to stake out territory
of their own.

If one were designing a C-like language from scratch today, in the
light of past experience it would be wise to introduce some sort of
"package" concept and adhere strictly to it.



More information about the Comp.std.c mailing list