[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021年10月29日 01:03:46 -0700

On 2021年10月20日 02:55:52 +0200
Victor Stinner <[email protected]> wrote:
> 
> Debug build
> -----------
> 
> When Python is built in debug mode, most compiler optimizations are
> disabled. For example, Visual Studio disables inlining. Benchmarks must
> not be run on a Python debug build, only on release build: using LTO and
> PGO is recommended for reliable benchmarks. PGO helps the compiler to
> decide if function should be inlined or not.
So what is the performance impact on debug builds? The numbers should
be given in the PEP.
> Rejected Ideas
> ==============
> 
> Keep macros, but fix some macro issues
> --------------------------------------
> 
> Converting macros to functions is not needed to `remove the return
> value`_: casting a macro return value to ``void`` also fix the issue.
> For example, the ``PyList_SET_ITEM()`` macro was already fixed like
> that.
> 
> Macros are always "inlined" with any C compiler.
> 
> The duplication of side effects can be worked around in the caller of
> the macro.
> 
> People using macros should be considered "consenting adults". People who
> feel unsafe with macros should simply not use them.
This says that the idea is rejected, but it does not say *why* it was
rejected. Can you add that?
Regards
Antoine.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/F57647TKEQLXX7JXAHUVCFWHUMU3SW2N/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to