Espaços nominais
Variantes
Acções

std::realloc

Da cppreference.com
< cpp‎ | memory‎ | c

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
Gerenciamento de memória dinâmica
Gerenciamento de memória de baixo nível
Alocadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uninitialized armazenamento
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ponteiros inteligentes
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
(obsoleta)
(C++11)
Apoio a coleta de lixo
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
(C++11)
(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
realloc
 
Definido no cabeçalho <cstdlib>
void *realloc( void *ptr, std::size_t new_size );
Realoca a determinada área de memória. Deve ser previamente alocado pelo malloc(), calloc() ou realloc() e ainda não liberado com free(), caso contrário, os resultados são indefinidos.
Original:
Reallocates the given area of memory. It must be previously allocated by malloc(), calloc() or realloc() and not yet freed with free(), otherwise, the results are undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
A redistribuição é feita por meio de:
Original:
The reallocation is done by either:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
a)
expandir a área existente apontado por ptr, se possível. O conteúdo da zona permanecem inalteradas até ao menor dos tamanhos novos e velhos. Se a zona for expandido, o conteúdo da nova parte da matriz são indefinidos.
Original:
expanding the existing area pointed to by ptr, if possible. The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the contents of the new part of the array are undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
b)
atribuição de um novo bloco de memória de bytes new_size tamanho, cópia área de memória com tamanho igual a menor da nova e os tamanhos de idade, e libertar o antigo bloco.
Original:
allocating a new memory block of size new_size bytes, copying memory area with size equal the lesser of the new and the old sizes, and freeing the old block.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se não houver memória suficiente, o bloco de memória de idade não é liberada e ponteiro nulo é devolvido.
Original:
If there is not enough memory, the old memory block is not freed and null-pointer is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

ptr -
ponteiro para a área de memória para ser realocado
Original:
pointer to the memory area to be reallocated
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
new_size -
novo tamanho da matriz
Original:
new size of the array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

Ponteiro para o início da memória recém-alocado ou NULL se o erro ocorreu. O ponteiro deve ser desalocado com free().
Original:
Pointer to the beginning of newly allocated memory or NULL if error has occurred. The pointer must be deallocated with free().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

[editar] Veja também

Documentação C para realloc