Reserved names in ANSI C

david.f.prosser dfp at cbnewsl.ATT.COM
Wed Jun 21 23:34:03 AEST 1989


In article <1598 at cbnewsh.ATT.COM> ka at hulk.att.com writes:
>karl at haddock.ima.isc.com (Karl Heuer) writes:
>> Technically this is illegal because the str* namespace is reserved...
>
>I know that ANSI C reserves all names that begin with and underscore,
>and I just learned from the above quote that it reserves all names
>beginning with "str".  Are there other names to be avoided as well?
>				Kenneth Almquist

Section 4.1.2.1 of the pANS goes into some detail about what is reserved
in varying circumstances, but the best rule of thumb is to keep away from
names that begin with _ and remember that the following patterns (egrep-type
meta-characters) are also reserved:

	<errno.h>	macros		E[0-9A-Z][_0-9a-zA-Z]*
	<ctype.h>	functions	(is|to)[a-z][_0-9a-zA-Z]*
	<locale.h>	macros		LC_[A-Z][_0-9a-zA-Z]*
	<math.h>	functions	"existing functions"[fl]
	<signal.h>	macros		(SIG|SIG_)[A-Z][_0-9a-zA-Z]*
	<stdlib.h>	functions	str[a-z][_0-9a-zA-Z]*
	<string.h>	functions	(str|mem|wcs)[a-z][_0-9a-zA-Z]*

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.std.c mailing list