[cfe-dev] [PATCH] Libc++ Windows fixes (Attention all libc++ ports!!!)

David Blaikie dblaikie at gmail.com
Tue Sep 27 12:15:49 PDT 2011


On Tue, Sep 27, 2011 at 10:58 AM, John McCall <rjmccall at apple.com> wrote:

> On Sep 27, 2011, at 10:35 AM, Matthieu Monrocq wrote:
>
> 2011/9/26 Thomas Gamper <icicle at mail.cg.tuwien.ac.at>
>
>> For whatever reason Microsoft is prefixing many standard POSIX
>> functions with an underscore:
>>
>> http://msdn.microsoft.com/en-us/library/ybk95axf%28v=vs.80%29.aspx
>>
>> int _sprintf_l(
>>    char *buffer,
>>    const char *format,
>>    locale_t locale [,
>>       argument] ...
>> );
>>
>> I hope this helps,
>> TOM
>>
>
> Probably because such identifiers (leading underscore) are reserved for the
> implementation at global scope.
>
>
> No, identifiers are only reserved if they start with two underscores
> (__foo) or an underscore and a capital letter (_Foo).
>

Those names are reserved universally, names begining with an underscore are
reserved for the implementation in the global namespace. 17.6.4.3.2\1:

Certain sets of names and function signatures are always reserved to the
implementation:
— Each name that contains a double underscore _ _ or begins with an
underscore followed by an uppercase
letter (2.12) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation
for use as a name in the
global namespace.

> The POSIX Standard "pollutes" the global namespace with identifiers that
> fall within userland therefore, while MSVC does not :)
>
>
> Only in the same sense that the C standard "pollutes" the global namespace
> with memcpy and malloc.
>

Except those are documented names already in the standard.


> Anyway, doesn't really matter;  it's what they do.
>

Right.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110927/c135024e/attachment.html>


More information about the cfe-dev mailing list