|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
void * _aligned_offset_recalloc( void *memblock, size_t num, size_t size, size_t alignment, size_t offset );
The current memory block pointer.
Number of elements.
Length in bytes of each element.
The alignment value, which must be an integer power of 2.
The offset into the memory allocation to force the alignment.
_aligned_offset_recalloc returns a void pointer to the reallocated (and possibly moved) memory block. The return value is NULL if the size is zero and the buffer argument is not NULL, or if there is not enough available memory to expand the block to the given size. In the first case, the original block is freed. In the second case, the original block is unchanged. The return value points to a storage space that is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.
_aligned_offset_recalloc 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 and restrict.
Like _aligned_offset_malloc, _aligned_offset_recalloc allows a structure to be aligned at an offset within the structure.
_aligned_offset_recalloc is based on malloc. For more information about using _aligned_offset_malloc, see malloc. If memblock is NULL, the function calls _aligned_offset_malloc internally.
In Visual C++ 2005, this function sets errno to ENOMEM if the memory allocation failed or if the requested size (num * size) was greater than _HEAP_MAXREQ. For more information about errno, see . Also, _aligned_offset_recalloc validates its parameters. If alignment is not a power of 2 or if offset is greater than or equal to the requested size and nonzero, this function invokes the invalid parameter handler, as described in . If execution is allowed to continue, this function returns NULL and sets errno to EINVAL.
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.