Naming

Henry Spencer henry at utzoo.uucp
Thu Feb 22 06:06:12 AEST 1990


In article <MCDANIEL.90Feb20172440 at orenda.amara.uucp> mcdaniel at amara.uucp (Tim McDaniel) writes:
>What names are reserved in ANSI C? ...

Unfortunately, there are a whole pile of them, and they don't follow any
particularly regular pattern.  Everything in the ANSI C library is reserved,
modulo some small escape clauses for things like macros if you don't include
the relevant header file(s).  And there are a bunch of reservations for
future expansion, some of which are macros and hence applicable only if
relevant header files are included, some of which are external names and
hence are reserved regardless.  For example, not only are all the function
names in <math.h> reserved, so are those names suffixed by "f" or "l", for
future provision of float and long-double variants.

Over and above the existing C-library names, and the <math.h> extension
reservation, the list is:

	_[_A-Z].*	everywhere for all purposes
	_[a-zA-Z0-9_].*	everywhere as file-scope identifiers and tags
	E[0-9A-Z].*	in <errno.h>
	(is|to)[a-z].*	as external names, and in <ctype.h>
	LC_[A-Z].*	in <locale.h>
	SIG_?[A-Z].*	in <signal.h>
	str[a-z].*	as external names, and in <stdlib.h> or <string.h>
	mem[a-z].*	as external names, and in <string.h>
	wcs[a-z].*	as external names, and in <string.h>

>... How about in the current UNIX
>standardization effort?

POSIX basically goes by the ANSI rules unless you define _POSIX_SOURCE
before including headers, in which case more standard names appear.
Also there are some POSIX-specific headers.  In particular, <sys/types.h>
can define any .*_t name.
-- 
"The N in NFS stands for Not, |     Henry Spencer at U of Toronto Zoology
or Need, or perhaps Nightmare"| uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.std.c mailing list