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

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlu924AACgkQ9TYGna5E
T6D/5RAAhLClO/Lt9paeEAfmNukhVlIlMUH8K2Ds5U72SHNppILneo0mQi+NOfZE
XVlEbp9lGDOXAZGHCG99/q4Hn2A2sJsqNOTNoSrZ9ycknkezghSpdZ3AegTQm4oq
mUUaK3l9icKgYapkJvC6nInCv69A8+NF6eGmrhKccEcsPDblaYCO3/0S8sv/wi1L
wA8Rn/ud9Xssnddtf0VEsU8UPfIrihnYomfxN9uM2L7fnqQw1fdpDf9fWyDEjugX
AseNQXJGVySIVz8yPLVD1/1Cf8bwTac0/HaEGdfy4cKsUet3mwKlNTgcQAaYOxr3
7XrUG0ewQnPOngSX3pBfPZWd6x8liIkfppNi28Qyp47O15P70FLA1UY7prNjZkee
59PYArXFPwCwqCVdA+uC/DBUP5GYl1/z/C64OjZtwzU9cFy5hIo/1tk2x1Bt6a/U
5nxAjvNZKwGW6uVFlFbAsfL6IWrUTkTEPWiPJJOHtHCD+pVXsTFEyu+GTpvwWcrd
UPxpDdZRpxZQJ6gOlUDsL6NHO81ebONeZ613swR/9WAhFx2hSLsALLLvJMkqMAUl
A2rA3pa7uRRpR/5XkPfCmSWrC3NzQz6zPpoin+HspRf2KbJi2H3K8jFu1LNwMl9n
/psDHz1Zz+G96p2Eq4M6f9ngAADKK/QNkOLxRmLcmhr+s481+2I=
=UI7G
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.