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

Glenn Elliott glenn@aurora.tech
Wed Oct 10 05:42:00 GMT 2018


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?


More information about the Newlib mailing list