std::malloc — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Déclaré dans l'en-tête <cstdlib> |
||
|
|
||
Alloue size octets de stockage non initialisée .
Original:
Allocates size bytes of uninitialized storage.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si l'allocation réussit, renvoie un pointeur vers le plus bas (premier) octet dans le bloc de mémoire alloué qui est correctement alignée pour n'importe quel type d'objet .
Original:
If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any object type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si size est égal à zéro, le comportement est défini par l'implémentation (pointeur NULL peut être retourné, ou quelque pointeur non NULL peuvent être retournés qui ne peut pas être utilisé pour accéder au stockage)
Original:
If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Paramètres
| size | - | nombre d'octets à allouer Original: number of bytes to allocate The text has been machine-translated via Google Translate. |
Retourne la valeur
Pointeur au début de la mémoire nouvellement allouée ou pointeur null si erreur s'est produite. Le pointeur doit être libérée avec free() .
Original:
Pointer to the beginning of newly allocated memory or null pointer 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.
Notes
Cette fonction n'est pas appeler des constructeurs ou initialiser la mémoire d'aucune façon. Ainsi méthode préférée de l'allocation de mémoire est l'expression
new.
Original:
This function does not call constructors or initialize memory in any way. Thus preferred method of memory allocation is
newexpression.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exemple
Voir aussi
fonctions d'allocation Original: allocation functions The text has been machine-translated via Google Translate. (fonction) [edit] | |
obtient de stockage non initialisée Original: obtains uninitialized storage The text has been machine-translated via Google Translate. (fonction générique) [edit] | |
C documentation for malloc | |