Files
2025-10-25 03:02:53 +03:00

3.0 KiB

[diff.cpp03.lex]

Annex C (informative) Compatibility [diff]

C.6 C++ and ISO C++ 2003 [diff.cpp03]

C.6.2 [lex]: lexical conventions [diff.cpp03.lex]

1

#

Affected subclause: [lex.pptoken]

Change: New kinds of string-literals.

Rationale: Required for new features.

Effect on original feature: Valid C++ 2003 code may fail to compile or produce different results in this revision of C++.

Specifically, macros named R, u8,u8R, u, uR, U, UR, or LR will not be expanded when adjacent to a string-literal but will be interpreted as part of the string-literal.

[Example 1: #define u8 "abc"const char* s = u8"def"; // Previously "abcdef", now "def" — end example]

2

#

Affected subclause: [lex.pptoken]

Change: User-defined literal string support.

Rationale: Required for new features.

Effect on original feature: Valid C++ 2003 code may fail to compile or produce different results in this revision of C++.

[Example 2: #define _x "there""hello"_x // #1

Previously, #1 would have consisted of two separate preprocessing tokens and the macro _x would have been expanded.

In this revision of C++, #1 consists of a single preprocessing token, so the macro is not expanded.

— end example]

3

#

Affected subclause: [lex.key]

Change: New keywords.

Rationale: Required for new features.

Effect on original feature: Added to Table 5, the following identifiers are new keywords:alignas,alignof,char16_t,char32_t,constexpr,decltype,noexcept,nullptr,static_assert, andthread_local.

Valid C++ 2003 code using these identifiers is invalid in this revision of C++.

4

#

Affected subclause: [lex.icon]

Change: Type of integer literals.

Rationale: C99 compatibility.

Effect on original feature: Certain integer literals larger than can be represented by long could change from an unsigned integer type to signed long long.