Skip to content

Commit ec127b7

Browse files
committed
realloc : 備考を整理
1 parent 7f39905 commit ec127b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

reference/cstdlib/realloc.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ namespace std {
2727
- 新しいサイズの領域を確保、割り当てする。その後、新しいサイズと古いサイズのいずれか小さい方のサイズに等しいメモリ領域をコピーし、古いブロックを解放する。
2828
- メモリが不足している場合、`nullptr`が返される。
2929
30-
## 備考
31-
`new_size`が0の場合の動作は定義されていない。
3230
3331
## 戻り値
3432
再確保できた場合、その領域の先頭のポインタを返す。
3533
36-
なお、その領域はメモリリークを避けるため、`free`、`realloc`で解放する必要がある。
37-
3834
失敗した場合、`nullptr`を返す。もとのポインタは有効なままで、解放する必要がある。
3935
36+
37+
## 備考
38+
- `new_size`が0の場合の動作は未規定。
39+
- 確保された領域はメモリリークを避けるため、`free`、`realloc`で解放する必要がある。
40+
41+
4042
## 例
4143
```cpp example
4244
#include <cstdlib>

0 commit comments

Comments
 (0)