gh-141004: Reorganize and reword the 'Useful macros' section#144471
gh-141004: Reorganize and reword the 'Useful macros' section#144471encukou wants to merge 7 commits intopython:mainfrom
Conversation
- Group the macros - Roughly order them to put the most important ones first - Add expansions where it makes sense; especially if there's an equivalent in modern C or a common compiler
vstinner
left a comment
There was a problem hiding this comment.
Since you're already moving many functions, it may be interesting to sort functions in each category.
|
|
||
| A use for ``Py_UNREACHABLE()`` is following a call a function that | ||
| never returns but that is not declared :c:macro:`_Py_NO_RETURN`. | ||
| never returns but that is not declared ``_Noreturn``. |
There was a problem hiding this comment.
Note: C11 added _Noreturn, but C23 adds [[noreturn]] and deprecates _Noreturn.
There was a problem hiding this comment.
I'm aware, but don't want to get in the details too much.
We require C11, and as far as I know, deprecations in the C standard don't mean planned removal.
Co-authored-by: Victor Stinner <vstinner@python.org>
Sort by what? |
I'm thinking at the alphabetical order. |
|
Sorry, I just caused conflicts here with #144279. |
|
More macros -- more structure. How does this version look? I've grouped them in categories, and sorted by relevance first, alphabet second. For example, FWIW, I think combined entries are a great way to reduce duplication for things that do almost the same thing: |
ZeroIntensity
left a comment
There was a problem hiding this comment.
Mostly LGTM, with two little things below.
vstinner
left a comment
There was a problem hiding this comment.
LGTM. I like the new organization.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
ZeroIntensity
left a comment
There was a problem hiding this comment.
LGTM as well, thanks for the cleanup!
This is a follow-up to #143508. When all the public macros were documented, the section became somewhat unwieldy.
📚 Documentation preview 📚: https://cpython-previews--144471.org.readthedocs.build/