Namespace
Varianti

Order of evaluation

Da cppreference.com.
< cpp‎ | language

 
 
Linguaggio C + +
Temi generali
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.
Controllo del flusso
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.
Dichiarazioni esecuzione condizionale
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.
Iterazione dichiarazioni
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.
Vai dichiarazioni
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.
Funzioni
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
dichiarazione di funzione
lambda funzione dichiarazione
funzione di modello
specificatore inline
eccezioni specifiche (deprecato)
noexcept specificatore (C++11)
Eccezioni
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Spazi dei nomi
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipi
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
decltype specifier (C++11)
Specifiers
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 specificatori
Durata di stoccaggio specificatori
constexpr specificatore (C++11)
specificatore auto (C++11)
alignas specificatore (C++11)
Inizializzazione
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Letterali
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Espressioni
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
valore categorie
ordine di valutazione
rappresentazioni alternative
Utilities
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipi
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
Tipo alias dichiarazione (C++11)
attributi (C++11)
Lancia
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
conversioni implicite
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
Fusione C-stile e funzionale
Occupazione della memoria
Original:
Memory allocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classi
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Specifiche per una classe di funzioni proprietà
Original:
Class-specific function properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
esplicito (C++11)
statico
Funzioni membro speciali
Original:
Special member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Modelli
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
classe template
funzione di modello
modello di specializzazione
parametri confezioni (C++11)
Varie
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Montaggio in linea
 
Ordine di valutazione degli operandi di qualsiasi operatore di C + +, tra cui l'ordine di valutazione degli argomenti delle funzioni in una chiamata di funzione, l'espressione e l'ordine di valutazione delle sottoespressioni all'interno di qualsiasi espressione non è specificato (salvo quanto indicato di seguito). Il compilatore li valuterà in qualsiasi ordine, e può scegliere un altro ordine quando la stessa espressione viene valutata di nuovo.
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.
Non esiste il concetto di sinistra a destra o da destra a sinistra valutazione in C + +, che non deve essere confusa con da sinistra a destra e da destra a sinistra l'associatività degli operatori: il a + b + c espressione viene analizzata come (a + b) + c causa a sinistra a destra associatività di + operatore, ma il c sottoespressione può essere valutata prima (o l'ultimo, o al momento stesso o a b) in fase di esecuzione.
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.

Indice

[modifica] Sequenced-prima rulesNJ

[modifica] Definizioni

[modifica] Valutazioni

Ci sono due tipi di valutazioni eseguite dal compilatore per ogni espressione o sottoespressione (entrambi opzionali):
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.
  • Calcolo valore: calcolo del valore restituito dall'espressione. Questo può comportare la determinazione dell'identità dell'oggetto (glvalue valutazione, ad esempio se l'espressione restituisce un riferimento a un oggetto) o leggere il valore precedentemente assegnato ad un oggetto (valutazione prvalue, ad esempio se l'espressione restituisce un numero, o qualche altro valore )
    Original:
    value computation: calculation of the value that is returned by the expression. This may involve determination of the identity of the object (glvalue evaluation, e.g. if the expression returns a reference to some object) or reading the value previously assigned to an object (prvalue evaluation, e.g. if the expression returns a number, or some other value)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Effetto lato: accesso (lettura o scrittura) ad un oggetto designato da un volatile glvalue, modifica (scrittura) ad un oggetto, chiamando una biblioteca funzionalità I / O, o chiamare una funzione che fa una di queste operazioni.
    Original:
    side effect: access (read or write) to an object designated by a volatile glvalue, modification (writing) to an object, calling a library I/O function, 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.

[modifica] Ordinazione

"In sequenza-prima" è una asimmetrica, transitiva, a coppie rapporto tra le valutazioni all'interno dello stesso thread (che può estendersi in thread, se i tipi atomici sono coinvolti con std::memory_order adatto).
Original:
"sequenced-before" is an asymmetric, transitive, pair-wise relationship between evaluations within the same thread (it may extend across threads if atomic types are involved with suitable std::memory_order).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Se A è in sequenza prima di B, allora la valutazione di A sarà completata prima della valutazione del B inizia.
    Original:
    If A is sequenced before B, then evaluation of A will be complete before evaluation of B begins.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Se A non è in sequenza prima di B e B è in sequenza prima di A, allora la valutazione di B sarà completata prima della valutazione di A comincia.
    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.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Se A non è in sequenza prima di B e B non è in sequenza prima di A, allora esistono due possibilità:
    Original:
    If A is not sequenced before B and B is not sequenced before A, then two possibilities exist:
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • * Valutazioni di A e B sono non in sequenza: possono essere eseguiti in qualsiasi ordine e possono sovrapporsi (all'interno di un singolo thread di esecuzione, il compilatore può alterna le istruzioni che comprendono CPU A e B)
    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.
  • * Valutazioni di A e B sono indeterminably-sequenza: possono essere eseguite in qualsiasi ordine, ma non possono sovrapporsi: o A sarà completa prima di B, o B sarà completa prima di A. L'ordine può essere il contrario la prossima volta lo stesso espressione viene valutata.
    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.

[modifica] Regole

1)
Ogni calcolo del valore e effetti collaterali di una piena espressione (un'espressione che non fa parte di un'altra espressione, in genere uno che termina con un punto e virgola) è in sequenza prima di ogni calcolo del valore e effetto collaterale l'espressione successiva completa.
Original:
Each value computation and side effect of a full expression (an expression that is not part of another expression, typically one that ends with a semicolon) is sequenced before each value computation and side effect of 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.
2)
I calcoli di valore (ma non gli effetti collaterali) degli operandi di ogni operatore sono in sequenza prima il calcolo del valore del risultato dell'operatore (ma non i suoi effetti collaterali).
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).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Quando si chiama una funzione (se la funzione è in linea, e se non esplicita sintassi di chiamata di funzione è utilizzato), ogni calcolo del valore e gli effetti collaterali associati con qualsiasi espressione argomento, o con l'espressione postfix che designa la funzione chiamata, viene sequenziato prima esecuzione di ogni espressione o istruzione nel corpo della funzione chiamata.
Original:
When calling a function (whether or not the function is inline, and whether or not explicit function call syntax is used), every value computation and side effect associated with any argument expression, or with the postfix expression designating the called function, is sequenced before execution of every expression or statement in the body of the called function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Il calcolo del valore degli operatori built-in post-incremento e postdecrement è sequenziato prima del suo effetto collaterale.
Original:
The value computation of the built-in postincrement and postdecrement operators is sequenced before its side-effect.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
L'effetto collaterale di built-in pre-incremento e gli operatori predecremento è sequenziato prima del calcolo del valore (regola implicita per definizione come l'assegnazione composto)
Original:
The side effect of the built-in preincrement and predecrement operators is sequenced before its value computation (implicit rule due to definition as compound assignment)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Ogni effetto valore di calcolo e parte del primo (a sinistra) argomentazione della built-in && operatore logico AND e il built-in operatore logico OR
Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Ogni calcolo del valore e effetto collaterale associato alla prima espressione della logica:? operatore è in sequenza prima di ogni calcolo del valore e effetti collaterali associati con l'espressione secondo o terzo.
Original:
Every value computation and side effect associated with the first expression in the logical :? operator is sequenced before every value computation and side effect associated with the second or third expression.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
L'effetto collaterale (modifica l'argomento a sinistra) del built-in operatore di assegnazione e di tutte le built-in operatori di assegnazione composti è in sequenza dopo il calcolo del valore (ma non gli effetti collaterali) di argomenti di destra e sinistra, e viene sequenziato prima il calcolo valore dell'espressione di assegnazione (cioè, prima di restituire il riferimento all'oggetto modificato)
Original:
The side effect (modification of the left argument) of the built-in assignment operator and of all built-in compound assignment operators is sequenced after the value computation (but not the side effects) of both left and right arguments, and is sequenced before the value computation of the assignment expression (that is, before returning the reference to the modified object)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Ogni calcolo del valore e effetto collaterale della prima (a sinistra) argomentazione della built-in operatore virgola viene sequenziato prima di ogni calcolo del valore e effetto collaterale della seconda (a destra) l'argomento.
Original:
Every value computation and side effect of the first (left) argument of the built-in comma operator is sequenced before every value computation and side effect of the second (right) argument.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
10)
In list-inizializzazione, ogni effetto valore di calcolo e sul lato di una clausola di inizializzatore data è in sequenza prima di ogni calcolo del valore e effetto collaterale associato a qualsiasi clausola inizializzatore che lo segue in elenco separato da virgole della lista di inizializzazione.
Original:
In list-inizializzazione, every value computation and side effect of a given initializer clause is sequenced before every value computation and side effect associated with any initializer clause that follows it in the comma-separated list of the initializer list.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
11)
Una chiamata di funzione che non viene sequenziato prima o in sequenza dopo l'altra chiamata di funzione è indeterminata sequenziato (il programma deve comportarsi as if le istruzioni della CPU che costituiscono diverse chiamate di funzione non sono stati intercalati, anche se le funzioni sono state inline)
Original:
A function call that is not sequenced before or sequenced after another function call is indeterminately sequenced (the program must behave as if the CPU instructions that constitute different function calls were not interleaved, even if the functions were inlined)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
12)
La chiamata alla funzione di allocazione (nuovo operatore) è indeterminatamente sequenziato rispetto alla valutazione degli argomenti del costruttore in una nuova espressione
Original:
The call to the allocation function (operator new) is indeterminately sequenced with respect to the evaluation of the constructor arguments in a new-expression
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Comportamento non definito

1)
Se un effetto collaterale su un oggetto scalare è non in sequenza rispetto ad un altro effetto collaterale sull'oggetto scalare stessa, il comportamento è indefinito.
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 (but i = ++i + 1; is well-defined)
f(++i, ++i); // undefined behavior
f(i = -1, i = -1); // undefined behavior

2)
Se un effetto collaterale su un oggetto scalare è non in sequenza rispetto ad un valore di calcolo utilizzando il valore dell'oggetto scalare stessa, il comportamento è indefinito.
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.

cout << i << i++; // undefined behavior
a[i] = i++; // undefined bevahior

[modifica] Sequenza punto rulesNJ

[modifica] Definizioni

La valutazione di un'espressione potrebbe produrre effetti collaterali, che sono: l'accesso a un oggetto designato da un volatile lvalue, modifica di un oggetto, la chiamata di una biblioteca funzionalità I / O, o chiamare una funzione che fa una di queste operazioni.
Original:
Evaluation of an expression might produce side effects, which are: accessing an object designated by a volatile lvalue, modifying an object, calling a library I/O function, 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.
Una sequenza' punto è un punto della sequenza di esecuzione in cui tutti gli effetti collaterali delle valutazioni precedenti nella sequenza sono completi, e senza effetti collaterali delle valutazioni successive iniziato.
Original:
A sequence point is a point in the execution sequence where all side effects from the previous evaluations in the sequence are complete, and no side effects of the subsequent evaluations started.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Regole

1)
Vi è un punto di sequenza alla fine di ciascun piena espressione (tipicamente, a virgola)
Original:
There is a sequence point at the end of each full expression (typically, at the semicolon)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Quando si chiama una funzione (se la funzione è in linea e se non chiamata di sintassi della funzione è stato utilizzato), vi è un punto di sequenza dopo la valutazione di tutti gli argomenti della funzione (se presenti) che si svolge prima dell'esecuzione di eventuali espressioni o istruzioni in la funzione del corpo
Original:
When calling a function (whether or not the function is inline and whether or not function call syntax was used), there is a sequence point after the evaluation of all function arguments (if any) which takes place before execution of any expressions or statements in the function body
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Vi è un punto di sequenza dopo la copia di un valore restituito di una funzione e prima dell'esecuzione di eventuali espressioni all'esterno della funzione.
Original:
There is a sequence point after the copying of a returned value of a function and before the execution of any expressions outside the function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Una volta che l'esecuzione di una funzione inizia, nessuna espressione della funzione chiamante vengono valutati fino esecuzione della funzione chiamata è completata (funzioni non possono essere interleaved)
Original:
Once the execution of a function begins, no expressions from the calling function are evaluated until execution of the called function has completed (functions cannot be interleaved)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Nella valutazione di ciascuno dei seguenti quattro espressioni, utilizzando il built-in (non sovraccaricato) operatori, vi è un punto di sequenza dopo la valutazione dell'espressione a.
Original:
In the evaluation of each of the following four expressions, using the built-in (non-overloaded) operators, there is a sequence point after the evaluation of the expression a.
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
a ? b : c
a , b

[modifica] Comportamento non definito

1)
Tra il punto di sequenza precedente e successivo di un oggetto scalare deve avere il suo valore memorizzato modificata più di una volta dalla valutazione di un'espressione.
Original:
Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression.
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
i = ++i + 1; // undefined behavior (well-defined in C++11)
++ ++i; // undefined behavior (well-defined in C++11)
f(++i, ++i); // undefined behavior
f(i = -1, i = -1); // undefined behavior

2)
Tra il punto di sequenza precedente e successivo, il valore precedente di un oggetto scalare che è modificato dalla valutazione dell'espressione, è accessibile solo per determinare il valore da memorizzare.
Original:
Between the previous and next sequence point , the prior value of a scalar object that is modified by the evaluation of the expression, shall be accessed only to determine the value to be stored.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

cout << i << i++; // undefined behavior
a[i] = i++; // undefined bevahior

[modifica] Vedi anche