Espaços nominais
Variantes
Acções

Storage duration specifiers

Da cppreference.com
< cpp‎ | language

 
 
Linguagem C + +
Tópicos gerais
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.
Controle de fluxo
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.
Declarações execução condicional
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.
Instruções de iteração
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.
Ir declarações
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.
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declaração da função
lambda declaração da função
modelo de função
linha especificador
especificações de exceção (obsoleta)
noexcept especificador (C++11)
Exceções
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Namespaces
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipos
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)
Especificadores
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 especificadores
armazenamento duração especificadores
constexpr especificador (C++11)
auto especificador (C++11)
alignas especificador (C++11)
Inicialização
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Literais
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Expressões
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
representações alternativas
Utilitários
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Tipos
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 de alias declaração (C++11)
atributos (C++11)
Lança
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
conversões implícitas
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
Elenco C-estilo e funcional
Alocação de memória
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.
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classe propriedades específicas de função
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.
Funções membro especiais
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.
Modelos
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
modelo de classe
modelo de função
especialização de modelo
pacotes de parâmetros (C++11)
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Assembly embutido
 
  • auto -' duração de armazenamento automático. (obsoleta)
    Original:
    auto - automatic storage duration. (obsoleta)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • register -' duração de armazenamento automático. Também indica para o compilador para colocar a variável no registo do processador. (obsoleta)
    Original:
    register - automatic storage duration. Also hints to the compiler to place the variable in the processor's register. (obsoleta)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • static - duração de armazenagem estática e interna ligação
    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 - duração de armazenagem estática e' ligação externa
    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 -' fio duração de armazenamento. (a partir do C++ 11)
    Original:
    thread_local - thread storage duration. (a partir do C++ 11)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Explicação

[editar] Tempo de armazenamento

Todas as variáveis ​​em um programa de ter uma das seguintes durações de armazenagem:
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.
  • ' 'Automático duração de armazenamento. A variável é atribuído no início do bloco de código colocando e desalocadas no final. Todas as variáveis ​​não-globais tem esse tempo de armazenamento, exceto os declarados static, extern ou 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.
  • ' 'Estática tempo de armazenamento. A variável é atribuído quando o programa começa e desalocado quando o programa termina. Apenas uma instância da variável existe. Todas as variáveis ​​globais tem esse tempo de armazenamento, além de declarados com static ou 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.
  • ' 'Rosca tempo de armazenamento (a partir do C++ 11). A variável é atribuído quando a linha começa e desalocado quando a thread terminar. Cada segmento tem sua própria instância da variável. Apenas variáveis ​​declarou thread_local ter este tempo de armazenamento. thread_local só pode ser declarada para variáveis ​​globais, mais aqueles declarados com static ou extern.
    Original:
    thread storage duration (a partir do 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.
  • ' 'Dinâmico duração de armazenamento. A variável é alocado e desalocado por solicitação usando funções alocação dinâmica de memória.
    Original:
    dynamic storage duration. The variable is allocated and deallocated per request by using alocação dinâmica de memória functions.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

[editar] Ligação

Linkage refere-se à capacidade de uma variável ou função a ser referido em outros âmbitos. Se uma variável ou função com o mesmo identificador é declarado em vários âmbitos, mas não pode ser referido de todos eles, em seguida, várias instâncias da variável são gerados. As ligações seguintes são reconhecidos:
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.
  • ' 'Nenhuma ligação. A variável pode ser referida apenas do âmbito que está dentro Todas as variáveis ​​com tempos de armazenamento de rosca, automático e dinâmico tem essa ligação.
    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.
  • ' 'Interna ligação. A variável pode ser referido de todos os âmbitos da actual unidade de tradução. Todas as variáveis ​​com duração de armazenagem estática que são ou declarados static, ou const mas não extern, têm essa ligação.
    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.
  • ' 'Externa ligação. A variável pode ser referida a partir dos âmbitos em unidades de tradução outros. Todas as variáveis ​​com duração de armazenagem estática tem essa ligação, exceto aqueles static declarado, ou const mas não 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.

[editar] Palavras-chave

auto, register, static, extern, thread_local

[editar] Exemplo