std::malloc
提供: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. |
| Defined in header <cstdlib>
|
||
| void* malloc( std::size_t size ); |
||
初期化されていないストレージの割り当て
sizeバイト.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.
You can help to correct and verify the translation. Click here for instructions.
割り当てが成功した場合、適当に任意のオブジェクト型に整列された割り当てられたメモリブロックの最下位(最初の)バイトへのポインタを返す.
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.
You can help to correct and verify the translation. Click here for instructions.
sizeがゼロの場合、動作は実装定義(nullポインタが返されることがあります、または一部の非NULLポインタがストレージにアクセスするために使用されない場合があり、その戻される場合があります)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.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
| size | - | 割り当てるバイト数
Original: number of bytes to allocate The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
新たに割り当てられたメモリまたはNULLポインタの先頭を指すポインタエラーが発生した場合。ポインタは
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.
You can help to correct and verify the translation. Click here for instructions.
[編集] ノート
この関数は、コンストラクタを呼び出すか、または何らかの方法でメモリを初期化しません。したがって、メモリ割り当ての好ましい方法は、new式です.
Original:
This function does not call constructors or initialize memory in any way. Thus preferred method of memory allocation is new expression.
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.
[編集] 例
| This section is incomplete Reason: no example |
[編集] も参照してください
| 割り当て関数 Original: allocation functions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (機能) | |
| 初期化されていないストレージを取得します Original: obtains uninitialized storage The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
| C documentation for malloc
| |