Returns the maximum alignment satisfied by the provided address. The return value can be greater than any alignment value supported by the implementation. If p
is a null pointer value, â0â is returned to indicate that the pointer cannot be used to access an object of any type.
If the return value compares is greater than or equal to alignof(T), the alignment requirement for the type T
is satisfied by the pointer.
A freestanding implementation needs to provide memalignment
.
The alignment value of p
, or â0â if p
is a null pointer value.
On common platforms where
this function can be implemented as return (size_t)p & -(size_t)p;.
[edit] Example#include <stdio.h> #include <stdlib.h> int main() { alignas(128) int i = 0; printf("%zu\n%zu\n", memalignment(nullptr), memalignment(&i)); }
Possible output:
[edit] ReferencesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4