You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allocates memory on a specified alignment boundary.
16
16
@@ -25,33 +25,33 @@ void * _aligned_malloc(
25
25
26
26
### Parameters
27
27
28
-
*size*<br/>
28
+
*`size`*<br/>
29
29
Size of the requested memory allocation.
30
30
31
-
*alignment*<br/>
31
+
*`alignment`*<br/>
32
32
The alignment value, which must be an integer power of 2.
33
33
34
34
## Return Value
35
35
36
-
A pointer to the memory block that was allocated or NULL if the operation failed. The pointer is a multiple of *alignment*.
36
+
A pointer to the memory block that was allocated or `NULL` if the operation failed. The pointer is a multiple of *`alignment`*.
37
37
38
38
## Remarks
39
39
40
-
**_aligned_malloc** is based on [malloc](malloc.md).
40
+
**`_aligned_malloc`** is based on [`malloc`](malloc.md).
41
41
42
-
**_aligned_malloc** is marked `__declspec(noalias)` and `__declspec(restrict)`, meaning that the function is guaranteed not to modify global variables and that the pointer returned is not aliased. For more information, see [noalias](../../cpp/noalias.md) and [restrict](../../cpp/restrict.md).
42
+
**`_aligned_malloc`** is marked `__declspec(noalias)` and `__declspec(restrict)`, meaning that the function is guaranteed not to modify global variables and that the pointer returned is not aliased. For more information, see [`noalias`](../../cpp/noalias.md) and [`restrict`](../../cpp/restrict.md).
43
43
44
-
This function sets `errno` to `ENOMEM` if the memory allocation failed or if the requested size was greater than `_HEAP_MAXREQ`. For more information about `errno`, see [errno, _doserrno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md). Also, **_aligned_malloc** validates its parameters. If *alignment* is not a power of 2 or *size* is zero, this function invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, this function returns NULL and sets `errno` to `EINVAL`.
44
+
This function sets `errno` to `ENOMEM` if the memory allocation failed or if the requested size was greater than `_HEAP_MAXREQ`. For more information about `errno`, see [`errno`, `_doserrno`, `_sys_errlist`, and `_sys_nerr`](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md). Also, **`_aligned_malloc`** validates its parameters. If *`alignment`* is not a power of 2 or *`size`* is zero, this function invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, this function returns NULL and sets `errno` to `EINVAL`.
45
45
46
-
Use [_aligned_free](aligned-free.md) to deallocate memory obtained by both **_aligned_malloc** and `_aligned_offset_malloc`. Don't use `free`, which doesn't reclaim the aligned memory correctly and can lead to hard-to-diagnose bugs.
46
+
Use [`_aligned_free`](aligned-free.md) to deallocate memory obtained by both **`_aligned_malloc`** and `_aligned_offset_malloc`. Don't use `free`, which doesn't reclaim the aligned memory correctly and can lead to hard-to-diagnose bugs.
47
47
48
48
By default, this function's global state is scoped to the application. To change this, see [Global state in the CRT](../global-state.md).
Computes the number of elements in a statically-allocated array.
15
15
@@ -21,24 +21,24 @@ Computes the number of elements in a statically-allocated array.
21
21
22
22
### Parameters
23
23
24
-
*array*<br/>
24
+
*`array`*<br/>
25
25
The name of an array.
26
26
27
27
## Return Value
28
28
29
-
The number of elements in the array, expressed as a **size_t**.
29
+
The number of elements in the array, expressed as a **`size_t`**.
30
30
31
31
## Remarks
32
32
33
-
**_countof** is implemented as a function-like preprocessor macro. The C++ version has extra template machinery to detect at compile time if a pointer is passed instead of a statically declared array.
33
+
**`_countof`** is implemented as a function-like preprocessor macro. The C++ version has extra template machinery to detect at compile time if a pointer is passed instead of a statically declared array.
34
34
35
-
Ensure that *array* is actually an array, not a pointer. In C, **_countof** produces erroneous results if *array* is a pointer. In C++, **_countof** fails to compile if *array* is a pointer. An array passed as a parameter to a function *decays to a pointer*, which means that within the function, you can't use **_countof** to determine the extent of the array.
35
+
Ensure that *`array`* is actually an array, not a pointer. In C, **`_countof`** produces erroneous results if *`array`* is a pointer. In C++, **`_countof`** fails to compile if *`array`* is a pointer. An array passed as a parameter to a function *decays to a pointer*, which means that within the function, you can't use **`_countof`** to determine the extent of the array.
0 commit comments