New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyMem_Malloc() should guarantee alignof(max_align_t) #76093
Comments
Do you mean the C++ std::max_align_t? Does C99 have something like that? The Linux malloc() manual page says: "The malloc() and calloc() functions return a pointer to the allocated memory, which is suitably aligned for any built-in type." But I don't know the list of C built-in types. |
C11 has max_align_t, but also for C99 "any builtin type" means 16 byte alignment max_align_t is just a shorthand to express the concept. |
max_align_t is a bit of a kitchen sink and will specify larger and larger alignment in the future, e.g. 32-byte alignment for a complex _Float128 type (a pair of two _Float128 variables). The alignment is also not generally useful for allocations whose size is smaller than the alignment. (Many mallocs do not follow the C standard and do not provide 16-byte alignment when 8 bytes are allocated, although alignof(max_align_t) is 16.) |
Superseded by gh-91335 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: