File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 275275| P1102R2: [ ラムダ式で` () ` を省略できる条件を緩和] ( /lang/cpp23/down_with_lambda_parens.md ) | 修飾や戻り値型をともなってもパラメータリストが空であれば` () ` を省略できる | 11 | 13 | 2022.2 | - |
276276| P2173R1: [ ラムダ式に対する属性] ( /lang/cpp23/attributes_on_lambda_expressions.md ) | ラムダ式のいくつかの箇所に属性を記述できるようにする | 9 | 13 | 2022.2 | - |
277277| P1774R8: [ コード内容の仮定をコンパイラに伝えるassume属性] ( /lang/cpp23/portable_assumptions.md ) | 最適化のために、コードの仮定をコンパイラに伝える属性を標準化する | 13 | - | - | - |
278- | P2316R2: [ 文字リテラルエンコーディングを一貫させる] ( /lang/cpp23/consistent_character_literal_encoding.md.nolink ) | プリプロセッサの条件式での文字リテラルの扱いをC++式と同様にする | yes | yes | 2022.2 | 2022 |
278+ | P2316R2: [ 文字リテラルエンコーディングを一貫させる] ( /lang/cpp23/consistent_character_literal_encoding.md ) | プリプロセッサの条件式での文字リテラルの扱いをC++式と同様にする | yes | yes | 2022.2 | 2022 |
279279| P2334R1: [ ` elif ` /` elifdef ` /` elifndef ` のサポートを追加] ( /lang/cpp23/add_support_for_preprocessing_directives_elifdef_and_elifndef.md.nolink ) | ` #if ` /` #ifdef ` /` #ifndef ` に対応する複数条件命令のサポートを追加する | 12 | 13 | 2022.2 | - |
280280| P2437R1: [ ` #warning ` のサポートを追加] ( /lang/cpp23/warning.md ) | 多くのC++コンパイラが実装していたプリプロセス時の警告` #warning message ` を正式サポート | yes | yes | 2023.2 | yes |
281281| P2295R6: [ 汎用的なソースコードのエンコーディングとしてUTF-8をサポート] ( /lang/cpp23/support_for_utf8_as_a_portable_source_file_encoding.md.nolink ) | | 13 | 15 | 2023.2 | 2019 Update 2 |
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ C++23とは、2023年中に改訂される予定の、C++バージョンの通
9595
9696| 言語機能 | 説明 |
9797| ----------| ------|
98- | [ 文字リテラルエンコーディングを一貫させる] ( cpp23/consistent_character_literal_encoding.md.nolink ) | プリプロセッサの条件式での文字リテラルの扱いをC++式と同様にする |
98+ | [ 文字リテラルエンコーディングを一貫させる] ( cpp23/consistent_character_literal_encoding.md ) | プリプロセッサの条件式での文字リテラルの扱いをC++式と同様にする |
9999| [ ` elif ` /` elifdef ` /` elifndef ` のサポートを追加] ( cpp23/add_support_for_preprocessing_directives_elifdef_and_elifndef.md.nolink ) | ` #if ` /` #ifdef ` /` #ifndef ` に対応する複数条件命令のサポートを追加する |
100100| [ ` #warning ` のサポートを追加] ( cpp23/warning.md ) | 多くのC++コンパイラが実装していたプリプロセス時の警告` #warning message ` を正式サポート |
101101| [ 汎用的なソースコードのエンコーディングとしてUTF-8をサポート] ( cpp23/support_for_utf8_as_a_portable_source_file_encoding.md.nolink ) | |
Original file line number Diff line number Diff line change 1+ # 文字リテラルエンコーディングを一貫させる
2+ * cpp23[ meta cpp]
3+
4+ ## 概要
5+ C++20までは、以下のような、プリプロセッサ上での文字リテラルの比較と、if文での文字リテラルの比較が同じであるという保証がなかった。
6+
7+ ``` cpp
8+ #if 'A' == '\x41'
9+ //...
10+ #endif
11+ if (' A' == 0x41 ){}
12+ ```
13+
14+ プリプロセッサとそれ以外の文字列リテラルの解釈が一致するかどうかは実装定義となっていたが、これをプリプロセッサの文字列リテラルの解釈がプリプロセッサ外と一致するよう規定する。
15+
16+
17+ ## この機能が必要になった背景・経緯
18+ 1500以上のオープンソースプロジェクトを調査したところ、このような` #if ` マクロは、文字列リテラルのナロー文字エンコーディングを検出するために使われていた。
19+
20+ 主要なコンパイラはすべて期待通りに動作していたが、プリプロセッサではナロー文字エンコーディングの保証がなかったため、通常の文字リテラルと同じ規定とすることでこの動作を保証することとした。
21+
22+
23+ ## 参照
24+ - [ P2316R2 Consistent character literal encoding] ( https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2316r2.pdf )
You can’t perform that action at this time.
0 commit comments