◐ Shell
clean mode source ↗

Storage duration specifiers - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

  • auto - automatico durata di conservazione. (deprecato)

    Original:

    auto - automatic storage duration. (deprecato)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • register - automatico durata di conservazione. Accenna anche al compilatore per inserire la variabile nel registro del processore. (deprecato)

    Original:

    register - automatic storage duration. Also hints to the compiler to place the variable in the processor's register. (deprecato)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • static - statico durata di archiviazione e interno linkage

    Original:

    static - static storage duration and internal linkage

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • extern - statico stoccaggio durata e collegamento esterno

    Original:

    extern - static storage duration and external linkage

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • thread_local - filo stoccaggio durata. (dal C++11)

    Original:

    thread_local - thread storage duration. (dal C++11)

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Spiegazione

Durata di stoccaggio

Tutte le variabili in un programma hanno una delle durate di memorizzazione:

Original:

All variables in a program have one of the following storage durations:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

  • ' 'Automatico durata di conservazione. La variabile viene assegnato all'inizio del blocco di codice racchiude e deallocato sull'estremità. Tutte le variabili globali non hanno questa durata di conservazione, ad eccezione di quelli dichiarati static, extern o thread_local.

    Original:

    automatic storage duration. The variable is allocated at the beginning of the enclosing code block and deallocated on end. All non-global variables have this storage duration, except those declared static, extern or thread_local.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' 'Static durata di conservazione. La variabile è assegnato quando il programma inizia e deallocato quando il programma termina. Una sola istanza della variabile esiste. Tutte le variabili globali hanno la durata di conservazione, oltre a quelle dichiarate con static o extern.

    Original:

    static storage duration. The variable is allocated when the program begins and deallocated when the program ends. Only one instance of the variable exists. All global variables have this storage duration, plus those declared with static or extern.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' Filo durata di conservazione (dal C++11). La variabile è assegnato quando il thread inizia e deallocato quando il thread termina. Ogni thread ha una propria istanza della variabile. Solo le variabili dichiarate thread_local hanno questa durata di conservazione. thread_local può essere dichiarata solo per le variabili globali, oltre a quelle dichiarate con static o extern.

    Original:

    thread storage duration (dal C++11). The variable is allocated when the thread begins and deallocated when the thread ends. Each thread has its own instance of the variable. Only variables declared thread_local have this storage duration. thread_local can only be declared for global variables, plus those declared with static or extern.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' Dinamico durata di conservazione. La variabile viene allocata e deallocata per richiesta utilizzando funzioni allocazione dinamica della memoria.

    Original:

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Linkage

Linkage si riferisce alla capacità di una variabile o funzione da cui altri ambiti. Se una variabile o una funzione con lo stesso identificatore è dichiarata in ambiti diversi, ma non può essere indicato da tutti loro, poi diverse istanze della variabile vengono generati. I collegamenti disponibili sono:

Original:

Linkage refers to the ability of a variable or function to be referred to in other scopes. If a variable or function with the same identifier is declared in several scopes, but cannot be referred to from all of them, then several instances of the variable are generated. The following linkages are recognized:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

  • ' 'Nessun collegamento. La variabile può essere definito solo dal campo di applicazione che è dentro tutte le variabili con durata di archiviazione automatica, filo e dinamica hanno questo collegamento.

    Original:

    no linkage. The variable can be referred to only from the scope it is in. All variables with automatic, thread and dynamic storage durations have this linkage.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' 'Interno collegamento. La variabile può essere definito da tutti gli ambiti in unità di traduzione corrente. Tutte le variabili con durata di archiviazione statica che sono o dichiarati static, o const ma non extern, hanno questo collegamento.

    Original:

    internal linkage. The variable can be referred to from all scopes in the current translation unit. All variables with static storage duration which are either declared static, or const but not extern, have this linkage.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • ' 'Esterno per l'attacco. La variabile può essere indicato dagli scopi delle altre unità di traduzione. Tutte le variabili con durata di archiviazione statica hanno questo legame, ad eccezione di quelli dichiarati static, o const ma non extern.

    Original:

    external linkage. The variable can be referred to from the scopes in the other translation units. All variables with static storage duration have this linkage, except those declared static, or const but not extern.

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Parole chiave

auto, register, static, extern, thread_local

Esempio