Machine specific predefined names

Henry Spencer henry at utzoo.uucp
Sun Feb 21 16:54:19 AEST 1988


> Now our local stdc expert says that an ANSII compatible compiler
> can not use these names as they belong to the name space reserved
> for the user.  Such a compiler may only predefine names that
> belong to the name space reserved for the implementer, that is,
> names matching the ``_[A-Z_][0-9A-Za-z_]*'' pattern...
> 1) Is our local expert right?

Yes, although violation of this rule is listed as a "common extension" in
one of the appendixes (which are, note, not officially part of the standard).

> 2) If so, will companies such as SUN, AT&T, DEC etc. predefine
>    names such as _Sparc, _U3b2, _Vax in their ANSII C compilers?

Probably.

> I also wonder about exactly where the user / implementer boundary
> falls.  If the compiler vendor provides a system call library, is
> it considered part of an implementation?  If so, will the system
> calls have to be _Renamed?  This doesn't make sense to me.

Well, first note that the predefining rule cited by your local expert
applies specifically to *macros*, not necessarily to libraries.  Second,
while something like "open" clearly ought to be available under that
name, it would also be nice to have it available under some implementor-
reserved name like "__open" so that, say, "fopen" could call it without
requiring the user to avoid using "open" as the name of one of his own
functions.  This would greatly reduce the headache of having to remember
a large, growing, and machine-specific set of reserved names.  I think I
recall one of the earlier X3J11 drafts demanding that this be the case,
in fact, although I haven't finished reading the latest draft and can't
say whether such a rule is in there.  (Note, however, that the names of
the library functions actually defined in the standard *are* reserved --
along with a few general classes like str[a-z].* -- but at least that's
the same well-defined list for everyone.)
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list