名前空間
変種
操作

Order of evaluation

提供: cppreference.com
< c‎ | language

 
 
C言語
一般的なトピック
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
プリプロセッサ
コメント
キーワード
ASCIIチャート
エスケープシーケンスを
C
フロー制御
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
条件付き実行文
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
繰り返し文
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文をジャンプします
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
関数の宣言
の歴史。インライン指定
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
指定子
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CV指定
記憶クラス指定子
alignas指定子 (C99)
リテラル
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
評価の順序
代替演算子
演算子
演算子の優先順位
ユーティリティ
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
属性 (C99)
キャストします
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
インラインアセンブリ
 
任意の式の中の関数呼び出し式の中で関数の引数の評価順序を含む、任意のC言語の演算子のオペランド、および副式の評価順の評価の順序は不定である(以下特に明記する場合を除く)。コンパイラは、任意の順序でそれらを評価し、同じ式が再び評価されるときに別の注文を選択することができます.
Original:
Order of evaluation of the operands of any C operator, including the order of evaluation of function arguments in a function-call expression, and the order of evaluation of the subexpressions within any expression is unspecified (except where noted below). The compiler will evaluate them in any order, and may choose another order when the same expression is evaluated again.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
表現a + b + c(a + b) + c原因として解析されます:演算子の左から右へ、右から左結合と混同しないようにしてCの左から右または右から左への評価、という概念はありませんに左から右への+演算子の結合性が、部分式cは、実行時に(あるいは最後、またはまたはab同時に)、最初に評価することができる.
Original:
There is no concept of left-to-right or right-to-left evaluation in C, which is not to be confused with left-to-right and right-to-left associativity of operators: the expression a + b + c is parsed as (a + b) + c due to left-to-right associativity of operator+, but the subexpression c may be evaluated first (or last, or at the same time as a or b) at run time.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] 定義

[編集] 評価

それぞれの表現あるいはその部分式(オプションですどちらも)のためにコンパイラによって実行評価の2種類があります
Original:
There are two kinds of evaluations performed by the compiler for each expression or subexpression (both of which are optional):
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • の値の計算:式によって返される値の計算。これは、オブジェクト(左辺値評価)、または以前のオブジェクト(右辺の評価)に割り当てられた値を読み出すの同一性の決定を伴うことがあります
    Original:
    value computation: calculation of the value that is returned by the expression. This may involve determination of the identity of the object (lvalue evaluation) or reading the value previously assigned to an object (rvalue evaluation)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 副作用:、ファイルを変更して、浮動小数点環境(サポートされている場合)を変更する、またはその関数を呼び出して、オブジェクトに揮発性glvalue、変更(書き込み)によって指定されたオブジェクトへのアクセス権(読み取りまたは書き込み)これらの操作のいずれかを行います.
    Original:
    side effect: access (read or write) to an object designated by a volatile glvalue, modification (writing) to an object, modifying a file, modifying the floating-point environment (if supported), or calling a function that does any of those operations.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
全く副作用が発現によって産生されていないと、コンパイラは値が使用されていないと判断できる場合、式は評価されません.
Original:
If no side effects are produced by an expression and the compiler can determine that the value is not used, the expression is not evaluated.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] オーダー

"シークエンス·前"とは、同じスレッド内での評価との間に非対称、他動詞、ペアワイズの関係(原子の種類とメモリバリアが関与している場合、それは、スレッド間で延長することができる)です.
Original:
"sequenced-before" is an asymmetric, transitive, pair-wise relationship between evaluations within the same thread (it may extend across threads if atomic types and memory barriers are involved).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • シーケンスポイントが部分式E1とE2の間に存在している場合は、E1の両方の値の計算と副作用は、すべての値の計算とサイドE2のエフェクトの前に順序付けされます
    Original:
    If a sequence point is present between the subexpressions E1 and E2, then both value computation and side effects of E1 are sequenced before every value computation and side effect of E2
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 評価Bの前にシーケンスされた場合は評価Bの評価が開始される前に、その後の評価は完了します。 (C11以来)
    Original:
    If evaluation A is sequenced before evaluation B, then evaluation of A will be complete before evaluation of B begins. (C11以来)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • BとBが前に配列決定される前に、配列決定されていない場合の評価を開始する前に、Bの評価が完了します。 (C11以来)
    Original:
    If A is not sequenced before B and B is sequenced before A, then evaluation of B will be complete before evaluation of A begins. (C11以来)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • BとBが前に配列決定されていない前に、配列決定されていない場合は、2つの可能性があります:(C11以来)
    Original:
    If A is not sequenced before B and B is not sequenced before A, then two possibilities exist: (C11以来)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • AとBの*評価は、非配列されています:彼らは(単一の実行スレッド内では、コンパイラはAとBを構成するCPU命令をインターリーブすることがあります)どのような順序で実行されてもよいと重なるかもしれません
    Original:
    * evaluations of A and B are unsequenced: they may be performed in any order and may overlap (within a single thread of execution, the compiler may interleave the CPU instructions that comprise A and B)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • AとBの*評価がindeterminably順です:彼らはどのような順序で実行されてもよいが重複してはなりません:どちらかBの前に完全なものとなり、Aのいずれかの順序が同じ次回反対かもしれない前に、Bが完全なものとなる式が評価され.
    Original:
    * evaluations of A and B are indeterminably-sequenced: they may be performed in any order but may not overlap: either A will be complete before B, or B will be complete before A. The order may be the opposite the next time the same expression is evaluated.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[編集] ルール

1)
すべての関数の引数の評価後と関数指定の、実際の関数呼び出しの前にシーケンスポイントがあります.
Original:
There is a sequence point after the evaluation of all function arguments and of the function designator, and before the actual function call.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
任意の演算子のオペランドの値の計算(ただし、副作用でなく)演算の結果の値の計算(ただし、その副作用)の前に順序付けされます。 (C11以来)
Original:
The value computations (but not the side-effects) of the operands to any operator are sequenced before the value computation of the result of the operator (but not its side-effects). (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
最初の(左)のオペランドの評価後に、次の二項演算子の第二(右)のオペランドの評価の前にシーケンスポイントがあります:&&(論理積)、||(論理OR)、および,(カンマ).
Original:
There is a sequence point after evaluation of the first (left) operand and before evaluation of the second (right) operand of the following binary operators: && (logical AND), || (logical OR), and , (comma).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
最初の(左)のオペランドの評価後、条件演算子の?:の第2または第3オペランド(評価されている方)の評価の前にシーケンスポイントがあります
Original:
There is a sequence point after evaluation of the first (left) operand and before evaluation of the second or third operand (whichever is evaluated) of the conditional operator ?:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
直接代入演算子の、すべての複合代入演算子の副作用は(左引数の変更)は、左右両方の引数の値の計算(ただし、副作用)の後に配列決定される。 (C11以来)
Original:
The side effect (modification of the left argument) of the direct assignment operator and of all compound assignment operators is sequenced after the value computation (but not the side effects) of both left and right arguments. (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
ポストインクリメントとpostdecrement演算子の値の計算は、その副作用の前に配列決定される。 (C11以来)
Original:
The value computation of the postincrement and postdecrement operators is sequenced before its side-effect. (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
完全な宣言子の末尾にシーケンスポイントがあります。 (C99以来)
Original:
There is a sequence point at the end of a full declarator. (C99以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
完全な式の評価(部分式でない式:一般的にセミコロンまたは/スイッチ/中/行う場合の制御文で終わるもの)の後でシーケンスポイントがあると次のフル式の前には..
Original:
There is a sequence point after the evaluation of a full expression (an expression that is not a subexpression: typically something that ends with a semicolon or a controlling statement of if/switch/while/do) and before the next full expression.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
シーケンスポイントは、ライブラリ関数の戻り値の直前にあります。 (C99以来)
Original:
There is a sequence point immediately before the return of a library function. (C99以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
10)
シーケンスポイントは、フォーマットされたI / Oの各変換指定子に関連付けられたアクションの後にがある(C99以来)
Original:
There is a sequence point after the action associated with each conversion specifier in formatted I/O. (C99以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
11)
qsortbsearch、ならびに比較関数への呼び出しとqsort(C99以来)によって作られ、関連付けられたオブジェクトの移動の間に、ライブラリ関数によって行われた比較関数を呼び出すたびに、前後とすぐにシーケンスポイントがあります
Original:
There are sequence points before and immediately after each call to a comparison function made by the library functions qsort and bsearch, as well as between any call to the comparison function and the movement of the associated objects made by qsort (C99以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
12)
前に配列を決定するか、別の関数呼び出しの後に配列決定されていない関数呼び出しは不定(C11以来)(関数がインライン化された場合でも、別の関数呼び出しを構成するCPUの命令は、インタリーブすることはできません)配列決定される
Original:
A function call that is not sequenced before or sequenced after another function call is indeterminately sequenced (CPU instructions that constitute different function calls cannot be interleaved, even if the functions are inlined) (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
13)
初期化リスト式では、すべての評価が不確定に(C11以来)を配列決定する
Original:
In initialization list expressions, all evaluations are indeterminately sequenced (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
14)
不定順関数呼び出し、複合代入演算子の動作、インクリメント演算子とデクリメント演算子の前置と後置形態の両方に対して単一の評価です。 (C11以来)
Original:
With respect to an indeterminately-sequenced function call, the operation of compound assignment operators, and both prefix and postfix forms of increment and decrement operators are single evaluations. (C11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 未定義の動作

1)
スカラオブジェクトに副作用が同じスカラオブジェクトの別の副作用に対する相対非配列されている場合、動作は未定義です.
Original:
If a side effect on a scalar object is unsequenced relative to another side effect on the same scalar object, the behavior is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

i = ++i + i++; // undefined behavior
i = i++ + 1; // undefined behavior
f(++i, ++i); // undefined behavior
f(i = -1, i = -1); // undefined behavior

2)
スカラオブジェクトに副作用が同じスカラオブジェクトの値を使用して、値の計算に相対非配列されている場合、動作は未定義です.
Original:
If a side effect on a scalar object is unsequenced relative to a value computation using the value of the same scalar object, the behavior is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

f(i, i++); // undefined behavior
a[i] = i++; // undefined bevahior

3)
上記の規則は、部分式の順序が少なくとも1許容する限り適用されるようなシーケンスが付けられていない副作用を許可.
Original:
The above rules apply as long as at least one allowable ordering of subexpressions permits such an unsequenced side-effect.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] も参照してください

演算子の優先順位式は、そのソース·コード表現から構築される方法を定義している.
Original:
演算子の優先順位 which defines how expressions are built from their source code representation.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.