| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
typeobject.c includes <stddef.h> and <stdalign.h>, which should define max_align_t and alignof in C11. Yet, the Windows build complains: D:\a\cpython\cpython\Objects\typeobject.c(3558,34): warning C4013: 'alignof' undefined; assuming extern returning int [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
D:\a\cpython\cpython\Objects\typeobject.c(3558,53): error C2065: 'max_align_t': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
What am I missing? (The reference I linked to lists alignof as removed in C23, which is a bit misleading. The macro will be removed because it will become a keyword.) |
Sorry, something went wrong.
|
Looks like you need stdalign.h for alignof (defines the alignof macro to _Alignof), and max_align_t only seems to exist for C++ via cstddef, where it's mapped to double. |
Sorry, something went wrong.
|
That means I can't use max_align_t in CPython? Well, I can work around it. |
Sorry, something went wrong.
…e flags Now is not the time to fix that.
|
The TraceRefs buildbot failure:
is likely caused by gh-103621. |
Sorry, something went wrong.
There was a problem hiding this comment.
void* cannot participate in address arithmetics. You need to cast both data_ptr and instance to char * to get distance in bytes.
Sorry, something went wrong.
Smaller objects might not be aligned to ALIGNOF_MAX_ALIGN_T. The offsets calculated for PEP 697 should be aligned, though.
There was a problem hiding this comment.
Very nice!
Sorry for the late review; it took some time to dig through everything.
Sorry, something went wrong.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
|
Thank you for the thorough review! |
Sorry, something went wrong.
|
Thanks! I've got some more comments, but we can deal with those in a follow-up PR if you think it's worth it. Let's land this before the feature freeze kicks in. (I'm on mobile now; I won't be able to check the changes until tomorrow.) |
Sorry, something went wrong.
There was a problem hiding this comment.
Please, keep in mind that I neither participated in the PR discussion nor seen the PEP before. So I looked at the rendered docs in the same fashion as an outside user would do.
Here are three optional rough proposals and a forgotten full stop. However, they are non-binding suggestions that can be properly considered later, after 3.12b1 is out (otherwise the two remaining weeks will pass swiftly in the bikeshedding).
I've limited myself to the documentation because I have no expertise in the C API to check such a volume of code in such a short period of time.
Sorry, something went wrong.
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
There was a problem hiding this comment.
Thank you! Fresh eyes is exactly what the documentation needs.
It will also need a tutorial to bring the concepts together -- but when trying to write a tutorial, I keep finding rough edges that should be fixed first :)
Sorry, something went wrong.
|
Thanks for the reviews! I'll merge, and leave the issues open for other PRs. |
Sorry, something went wrong.
Good job! This is a very nice feature. |
Sorry, something went wrong.
|
Thank you! FWIW, here's a follow-up on the alignof(max_align_t): https://discuss.python.org/t/requiring-compilers-c11-standard-mode-to-build-cpython/26481 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PEP 697 describes the change. Some details it doesn't cover:
TODO: