tmp/tmpolpcc4lc/{from.md → to.md}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
### C library memory allocation <a id="c.malloc">[[c.malloc]]</a>
|
| 2 |
|
| 3 |
-
[*Note 1*: The header `<cstdlib>`
|
| 4 |
-
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
void* aligned_alloc(size_t alignment, size_t size);
|
| 8 |
void* calloc(size_t nmemb, size_t size);
|
| 9 |
void* malloc(size_t size);
|
|
@@ -12,11 +12,11 @@ void* realloc(void* ptr, size_t size);
|
|
| 12 |
|
| 13 |
*Effects:* These functions have the semantics specified in the C
|
| 14 |
standard library.
|
| 15 |
|
| 16 |
*Remarks:* These functions do not attempt to allocate storage by calling
|
| 17 |
-
`::operator new()`
|
| 18 |
|
| 19 |
Storage allocated directly with these functions is implicitly declared
|
| 20 |
reachable (see [[basic.stc.dynamic.safety]]) on allocation, ceases to
|
| 21 |
be declared reachable on deallocation, and need not cease to be declared
|
| 22 |
reachable as the result of an `undeclare_reachable()` call.
|
|
@@ -30,17 +30,22 @@ implemented with a separate allocation arena, bypassing the normal
|
|
| 30 |
intentionally be used as a replacement for `declare_reachable()`, and
|
| 31 |
newly written code is strongly encouraged to treat memory allocated with
|
| 32 |
these functions as though it were allocated with
|
| 33 |
`operator new`. — *end note*]
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
``` cpp
|
| 36 |
void free(void* ptr);
|
| 37 |
```
|
| 38 |
|
| 39 |
*Effects:* This function has the semantics specified in the C standard
|
| 40 |
library.
|
| 41 |
|
| 42 |
*Remarks:* This function does not attempt to deallocate storage by
|
| 43 |
calling `::operator delete()`.
|
| 44 |
|
| 45 |
-
ISO C
|
| 46 |
|
|
|
|
| 1 |
### C library memory allocation <a id="c.malloc">[[c.malloc]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: The header `<cstdlib>` declares the functions described in
|
| 4 |
+
this subclause. — *end note*]
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
void* aligned_alloc(size_t alignment, size_t size);
|
| 8 |
void* calloc(size_t nmemb, size_t size);
|
| 9 |
void* malloc(size_t size);
|
|
|
|
| 12 |
|
| 13 |
*Effects:* These functions have the semantics specified in the C
|
| 14 |
standard library.
|
| 15 |
|
| 16 |
*Remarks:* These functions do not attempt to allocate storage by calling
|
| 17 |
+
`::operator new()` [[new.delete]].
|
| 18 |
|
| 19 |
Storage allocated directly with these functions is implicitly declared
|
| 20 |
reachable (see [[basic.stc.dynamic.safety]]) on allocation, ceases to
|
| 21 |
be declared reachable on deallocation, and need not cease to be declared
|
| 22 |
reachable as the result of an `undeclare_reachable()` call.
|
|
|
|
| 30 |
intentionally be used as a replacement for `declare_reachable()`, and
|
| 31 |
newly written code is strongly encouraged to treat memory allocated with
|
| 32 |
these functions as though it were allocated with
|
| 33 |
`operator new`. — *end note*]
|
| 34 |
|
| 35 |
+
These functions implicitly create objects [[intro.object]] in the
|
| 36 |
+
returned region of storage and return a pointer to a suitable created
|
| 37 |
+
object. In the case of `calloc` and `realloc`, the objects are created
|
| 38 |
+
before the storage is zeroed or copied, respectively.
|
| 39 |
+
|
| 40 |
``` cpp
|
| 41 |
void free(void* ptr);
|
| 42 |
```
|
| 43 |
|
| 44 |
*Effects:* This function has the semantics specified in the C standard
|
| 45 |
library.
|
| 46 |
|
| 47 |
*Remarks:* This function does not attempt to deallocate storage by
|
| 48 |
calling `::operator delete()`.
|
| 49 |
|
| 50 |
+
See also: ISO C 7.22.3
|
| 51 |
|