Welcome! Log In Create A New Profile

Advanced

Re: use of C reserved identifiers

Vladimir Shebordaev
October 22, 2013 07:38PM
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.

Regards,
Vladimir

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
>

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

use of C reserved identifiers

Manlio Perillo 1088 October 22, 2013 10:34AM

Re: use of C reserved identifiers

Igor Sysoev 719 October 22, 2013 10:38AM

Re: use of C reserved identifiers

Manlio Perillo 427 October 22, 2013 11:08AM

Re: use of C reserved identifiers

Vladimir Shebordaev 683 October 22, 2013 07:38PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready