Comments (5)
この文脈では undefined behavior で良いように思います。unsequenced な二つの式の評価が問題になるのは、一方の副作用が他方に影響を与えるときでしたが、このとき undefined behavior [intro.execution]/17 になります。
むしろ、実引数の評価順序が「未規定」という方に語弊があるかもしれません。一つの関数呼び出しにおける「実引数同士」の評価については特に記述がないので unsequenced (混ぜて実行できる) と思われる [intro.execution]/18, [expr.call]/5, [intro.execution]/17 のですが、未規定と書くと indeterminately sequenced (順序づけはあるが未規定 [intro.execution]/15) とも取れます (unsequenced が別の種類の unspecified であるとは規格中に明記はありません)。とは書きつつ、この書籍では深いところには立ち入らずに初心者でも分かるように書くという趣旨がありますので、かように細かいことを気にしても仕方がないかもしれませんが。
すみません。撤回します。[expr.call]/5 に indeterminately sequenced と書かれていますね。従って、未規定です。
from cpp17book.
a.*b
抜け?
ところで、ここの箇所で挙げられている新しく順序付けられた式に a.*b
[expr.mptr.oper]/4 が抜けていませんか?
a.b
, a->b
の評価順序とは?
あと、純粋に疑問なのですが: a.b
および a->b
が列挙されていますが、b
はメンバ名になるので評価も何もない気がします…。さらに規格の対応する部分 [expr.ref] も探してみましたが sequenced 云々について見つけられませんでした (探し方が甘いだけかもしれませんが)。むしろ「演算子の左側の式が評価される」[expr.ref]/1と書かれています。
from cpp17book.
@akinomyoga (「未定義の挙動」について) なるほど、確かにそうですね。ご教示ありがとうございます。
from cpp17book.
あ、すいません、a, b, c, d
の問題はまだ解決していませんでした。reopen します。
from cpp17book.
Fixed by 4437751
from cpp17book.
Related Issues (16)
- 029 「初期化文つき条件文」のコード例 HOT 1
- 027 @= が何を指しているのか分からない HOT 1
- 050 boyer_moore_horspool_searcherの使い方で自己言及 HOT 1
- 043 memory_allocatorがdo_allocateを2回オーバーライド HOT 1
- 027 @= は複合代入演算子だけでなく単純代入演算子も含む? HOT 1
- 037 std::byteのサンプルコード中の「アルファベットの'l'」コメントが分からない HOT 1
- string_typeの使用例がない HOT 1
- pathのoperator string_type()に関する例がおかしい
- constexprラムダ式がtemplate中で使えないことを軽く触れておくべきではないか? HOT 5
- bool_constant: std::(true|false)_typeはC++11から
- noexceptについての表記の統一 HOT 3
- 028 constexpr if: ソースコードにtypoがある?
- 「sizeof(U)のサイズ」は重言
- バックスラッシュのエスケープ HOT 4
- 数値区切りの例は3桁区切りではない?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpp17book.