use of C reserved identifiers

Vladimir Shebordaev vshebordaev at
Tue Oct 22 23:36:19 UTC 2013

OMG, dо you mean ISO or ANSI are to certify nginx source code for 
the C language standards compliance?

I guess, it is the clause 7.1.3 of the recent ANSI/ISO C language 
standard that makes you so worry. The clause states that using 
the identifiers reserved for the C standard library usage results 
in undefined behavior.

Well, the behavior that is said to be undefined by the C language 
standard, must be pretty well defined by a particular compiler 
and a C standard library implementation. That is, when you are 
building nginx for a particular operating system, the behavior is 
rather implementation-defined, since you are bound to certain 
compiler and the C standard library implementation. In this case, 
when you redefine a macro that is already defined, e.g. by the 
system header file, the most probably, you will be strictly 
warned against doing so, or you even end up with a broken build.

I mean, there is basically no harm in the undefined behavior. 
Unless you know what you are doing.

As far as I can see, neither Igor nor other nginx developers do 
pretend to duplicate any C standard library functionality. 
Instead, they provide the API to the server core for module 
developers. The API header files should be considered as a part 
of the module's translation environment, while the server core is 
to be a significant part of its execution environment, pretty 
much like the C standard library for the server core itself.

Hope it helps.


On 22.10.2013 19:06, Manlio Perillo wrote:
> On 22/10/2013 16:36, Igor Sysoev wrote:
>> On Oct 22, 2013, at 18:32 , Manlio Perillo wrote:
>>> As per ISO C, identifiers that begin with an underscore and an
>>> uppercase letter are always reserved for any use; however in
>>> Nginx source code such identifiers are used as macros to guard
>>> against multiple file inclusion.
>>> This is not a real issue, but since it is easy to fix I have
>>> reported it.
>> I do not believe that C reserved words will ever start with
>> _NGX_...
> Of course, that's the reason why I wrote this is not a real issue.
> However, according to ISO C, doing so is still undefined behaviour;
> pratically this is not a problem, unless you want to get some
> sort of source code certification (?).
> Regards  Manlio

More information about the nginx-devel mailing list