Author: Douglas Gregor
This proposal recommends the removal of user-defined literals (N2765) from the C++0x working paper, per National Body comment US-18. The author believes that user-defined literals should be considered as a feature for future language standards, but that the risks associated with keeping this feature in the C++0x working paper far outweigh the benefits.
User-defined literals should be removed from the C++0x working paper for the following reasons:
<chrono>, for example). This may stem from a lack of interest, design problems that make this feature unsuitable for use in the standard library, or merely a pragmatic desire to not introduce features in the library that cannot be tested with an implementation. Regardless, we have no experience using this feature to write C++ code, nor are we giving users any guidance regarding how they should write C++ code with this feature.
0x1p+1). However, there is a conflict between C99 hexfloats and the user-defined literal operator "p", which forces compilers to pick one or the other interpretation. At least three compilers (GCC, EDG when emulating GCC, Clang) support hexfloats in C++ already, and will be affected by this conflict. The library prohibition on user-defined literal suffixes that don't start with an underscore ([usrlit.suffix]) is a weak attempt at addressing this problem, but the fundamental issue remains: there is a syntactic conflict in a proposal that claims to increase compatibility with C99. Indeed, user-defined literals may have the ability to improve compatibility if, for example, the C++0x Standard Library contained user-defined literals that emulate C99 hexfloats.
Overall, we have a feature that has no implementation or usage experience, conflicts with existing practice in the C99 standard without providing the promised compatibility improvements.
Modify section 2.5 [lex.pptoken] as follows:
preprocessing-token: header-name identifier pp-number character-literal user-defined-character-literal string-literal user-defined-string-literal preprocessing-op-or-punc each non-white-space character that cannot be one of the above
Modify section 2.10 [lex.ppnumber] as follows:
pp-number: digit . digit pp-number digit pp-number identifier-nondigit pp-number e sign pp-number E sign pp-number .
Modify 2.14.1 [lex.literal.kinds] as follows:
literal: integer-literal character-literal floating-literal string-literal boolean-literal pointer-literal user-defined-literal
Remove section 2.14.8 [lex.ext].
Modify 3 [basic] as follows:
Modify 5.1.1 [expr.prim.general]p1 as follows:
unqualified-id: identifier operator-function-id conversion-function-id literal-operator-id ~ class-name ~ decltype-specifier template-id
Remove section 13.5.8 [over.literal].
Remove section 184.108.40.206.5 [usrlit.suffix].