lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, May 20, 2020 at 8:39 PM Lorenzo Donati
<lorenzodonatibz@tiscali.it> wrote:
>
> I think you are wrong when you say that those identifiers are reserved
> only when a specific header is included.
>
> C99 draft N1256 under section 7.26 states:
>
> "All external names described below are reserved no matter what headers
> are included by the program."
>

Okay, I reread 7.1.3, and it turns out that it's actually more
complicated than either of us thought. While they're indeed always
"reserved", they're not always reserved in all contexts. Macro names
and identifiers with file scope are only reserved if you include the
relevant header (and even then, they're not "reserved for any use",
but this is already getting complicated enough). Identifiers with
external linkage, such as the functions, are reserved whether or not
you include the relevant header, but only for use with external
linkage. For example, just declaring something called "isfoobar" at
top-level isn't allowed regardless of whether ctype.h is included,
since it has external linkage, but if you declare it as "static" or
declare it inside a struct, union, or function definition, then it is
allowed, since it then doesn't have external linkage. (I'll
acknowledge that this all makes it even more insane, supporting your
original point.)

Joseph C. Sible