Storage duration specifiers
Aus cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
auto
- automatische Lagerdauer. (veraltet)Original:auto
- automatic storage duration. (veraltet)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.register
- automatische Lagerdauer. Auch Hinweise für den Compiler, um die Variable in der Prozessor-Register platzieren. (veraltet)Original:register
- automatic storage duration. Also hints to the compiler to place the variable in the processor's register. (veraltet)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.static
- statische Lagerdauer und intern VerknüpfungOriginal:static
- static storage duration and internal linkageThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.extern
- statische Lagerdauer und außen VerknüpfungOriginal:extern
- static storage duration and external linkageThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.thread_local
- Gewinde Lagerdauer. (seit C++11)Original:thread_local
- thread storage duration. (seit C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Erklärung
[Bearbeiten]Lagerdauer
Alle Variablen in einem Programm eine der folgenden Speicher-Laufzeiten:
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.
You can help to correct and verify the translation. Click here for instructions.
- ' 'Automatische Lagerdauer. Die Variable wird zu Beginn des einschließenden Codeblock reserviert und freigegeben am Ende. Alle nicht-globalen Variablen haben dieses Lagerdauer, mit Ausnahme deklariert
static
,extern
oderthread_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 declaredstatic
,extern
orthread_local
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- ' 'Static Lagerdauer. Die Variable zugeordnet wird, wenn das Programm beginnt und freigegeben, wenn das Programm beendet. Nur eine Instanz der Variable existiert. Alle globalen Variablen haben diese Lagerdauer, plus diejenigen, erklärte mit
static
oderextern
.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 withstatic
orextern
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- ' 'Thread Lagerdauer (seit C++11). Die Variable zugeordnet wird, wenn der Faden beginnt und freigegeben, wenn der Thread beendet. Jeder Thread hat eine eigene Instanz der Variable. Nur Variablen deklariert
thread_local
haben diese Lagerdauer.thread_local
kann nur für globale Variablen deklariert werden, plus die deklariertestatic
oderextern
.Original:thread storage duration (seit 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 declaredthread_local
have this storage duration.thread_local
can only be declared for global variables, plus those declared withstatic
orextern
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- ' 'Dynamic Lagerdauer. Die Variable wird reserviert und freigegeben pro Anforderung mithilfe dynamische Speicherverwaltung Funktionen .Original:dynamic storage duration. The variable is allocated and deallocated per request by using dynamische Speicherverwaltung functions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Linkage
Bindung bezieht sich auf die Fähigkeit einer Variable oder Funktion in anderen Bereichen bezeichnet. Wenn eine Variable oder Funktion mit dem gleichen Bezeichner in mehreren Bereichen deklariert wird, aber nicht, um aus allen von ihnen bezeichnet werden, werden dann mehrere Instanzen des variablen erzeugt. Die folgenden Verbindungen werden erkannt:
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.
You can help to correct and verify the translation. Click here for instructions.
- ' 'Keine Verknüpfung. Die Variable kann nur vom Umfang bezeichnet ist es in. Alle Variablen mit automatischer, Faden und dynamischen Speichermodul Dauern haben diese Bindung .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.
- ' 'Interne Bindung. Die Variable kann von allen Bereiche in der aktuellen Übersetzungseinheit bezeichnet werden. Alle Variablen mit statischen Lagerdauer, die entweder deklariert werden
static
oderconst
aber nichtextern
haben diese Verbindung .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 declaredstatic
, orconst
but notextern
, 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.
- ' 'Externe Bindung. Die Variable kann aus den Bereichen in den anderen Übersetzungseinheiten bezeichnet werden. Alle Variablen mit statischen Lagerdauer haben diese Verknüpfung, mit Ausnahme derjenigen, erklärte
static
oderconst
aber nichtextern
.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 declaredstatic
, orconst
but notextern
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Keywords
auto, register, static, extern, thread_local
[Bearbeiten]Beispiel
This section is incomplete |