From Jason Turner

[c.malloc]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp058w6rar/{from.md → to.md} +19 -4
tmp/tmp058w6rar/{from.md → to.md} RENAMED
@@ -5,23 +5,38 @@ 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);
10
- void* realloc(void* ptr, size_t size);
11
  ```
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
  These functions implicitly create objects [[intro.object]] in the
20
  returned region of storage and return a pointer to a suitable created
21
- object. In the case of `calloc` and `realloc`, the objects are created
22
- before the storage is zeroed or copied, respectively.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ``` cpp
25
  void free(void* ptr);
26
  ```
27
 
@@ -29,7 +44,7 @@ void free(void* ptr);
29
  library.
30
 
31
  *Remarks:* This function does not attempt to deallocate storage by
32
  calling `::operator delete()`.
33
 
34
- See also: ISO C 7.22.3
35
 
 
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);
 
10
  ```
11
 
12
  *Effects:* These functions have the semantics specified in the C
13
  standard library.
14
 
15
  *Remarks:* These functions do not attempt to allocate storage by calling
16
  `::operator new()` [[new.delete]].
17
 
18
  These functions implicitly create objects [[intro.object]] in the
19
  returned region of storage and return a pointer to a suitable created
20
+ object. In the case of `calloc`, the objects are created before the
21
+ storage is zeroed.
22
+
23
+ ``` cpp
24
+ void* realloc(void* ptr, size_t size);
25
+ ```
26
+
27
+ *Preconditions:* `free(ptr)` has well-defined behavior.
28
+
29
+ *Effects:* If `ptr` is not null and `size` is zero, the behavior is
30
+ erroneous and the effects are implementation-defined. Otherwise, this
31
+ function has the semantics specified in the C standard library.
32
+
33
+ *Remarks:* This function does not attempt to allocate storage by calling
34
+ `::operator new()` [[new.delete]]. When a non-null pointer is returned,
35
+ this function implicitly creates objects [[intro.object]] in the
36
+ returned region of storage and returns a pointer to a suitable created
37
+ object. The objects are created before the storage is copied.
38
 
39
  ``` cpp
40
  void free(void* ptr);
41
  ```
42
 
 
44
  library.
45
 
46
  *Remarks:* This function does not attempt to deallocate storage by
47
  calling `::operator delete()`.
48
 
49
+ See also: ISO C 7.24.4
50