File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,19 @@ int main() {
109109}
110110```
111111
112+ ## 備考
113+ - 以下のようなケースでは、erroneous behaviorではなく未定義動作を引き起こす可能性がある:
114+ ``` cpp
115+ T* p; // 未初期化のポインタ。erroneous value (例としてヌルポインタ) をもつ
116+ bool b; // 未初期化の真理値。
117+ // bool値として妥当な値表現をもたない可能性がある
118+ // (例: 値表現が8bitで{0x00(false), 0x01(true)}の
119+ // 2通りのみとする処理系で0xCCをもつなど)
120+
121+ f (* p); // 間接参照は未定義動作を引き起こす
122+ g(b); // bが妥当な値表現をもつ場合にerroneous behavior、そうでなければ未定義動作
123+ ```
124+
112125### 今後、「erroneous behavior」に分類される可能性のある操作
113126
114127現在、未定義動作に分類される以下の操作は、「erroneous behavior」に分類できる可能性がある。
@@ -124,19 +137,5 @@ int main() {
124137| 契約違反 | 契約に関する現在の策定作業では、契約違反時になにが起こるべきかという問題に直面している。「erroneous behavior」という概念は有用な回答を与えてくれる可能性がある |
125138
126139
127- ## 備考
128- - 以下のようなケースでは、erroneous behaviorではなく未定義動作を引き起こす可能性がある:
129- ``` cpp
130- T* p; // 未初期化のポインタ。erroneous value (例としてヌルポインタ) をもつ
131- bool b; // 未初期化の真理値。
132- // bool値として妥当な値表現をもたない可能性がある
133- // (例: 値表現が8bitで{0x00(false), 0x01(true)}の
134- // 2通りのみとする処理系で0xCCをもつなど)
135-
136- f (* p); // 間接参照は未定義動作を引き起こす
137- g(b); // bが妥当な値表現をもつ場合にerroneous behavior、そうでなければ未定義動作
138- ```
139-
140-
141140## 参照
142141- [ P2795R5 Erroneous behaviour for uninitialized reads] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2795r5.html )
You can’t perform that action at this time.
0 commit comments