This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ctype.h macros may conflict with C++11 UDL


On Oct  9 18:03, Glenn Elliott wrote:
> Hello newlib maintainers,
> 
> ctype.h “#define"s the following values: _U, _L, _N, _S, _P, _C, _X, and _B.
> 
> These macros may conflict with C++11 user defined literals (UDL) (https://en.cppreference.com/w/cpp/language/user_literal <https://en.cppreference.com/w/cpp/language/user_literal>).  It’s easy to see how C++11 UDL suffixes might conflict it the macros defined in ctype.h.  For instance, one may define a UDL function of “_N” to instantiate a C++ type that represents newtons of force.  Indeed, this is done by this units library: https://github.com/nholthaus/units <https://github.com/nholthaus/units>
> 
> Must these macros leak from ctype.h?

Yes, they have to, otherwise the isXXX ctype macros can't be resolved
successfully.  Am I the only one thinkiong it was a bit non-considerate
of the C++ standarization commitee to use the underscore in a way 
potentially colliding with implementation-defined symbols.

Probably the most feasible workaround is to change those macros to
double underscores throughout.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]