A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-February/132826.html below:

[Python-Dev] Start writing inlines rather than macros?

[Python-Dev] Start writing inlines rather than macros?Mark Shannon mark at hotpy.org
Thu Feb 27 19:23:14 CET 2014
On 27/02/14 13:06, Kristján Valur Jónsson wrote:
>
>
>> -----Original Message-----
>> From: Victor Stinner [mailto:victor.stinner at gmail.com]
>> Sent: 27. febrúar 2014 10:47
>> To: Kristján Valur Jónsson
>> Cc: Python-Dev (python-dev at python.org)
>> Subject: Re: [Python-Dev] Start writing inlines rather than macros?
>> In practice, recent versions of GCC and Clang are used. On Windows, it's
>> Visual Studio 2010. I'm pretty sure that these compilers support inline
>> functions.
>>
>> I'm also in favor of using inline functions instead of long macros using ugly
>> hacks like "instr1,instr2" syntax where instr1 used assert(). See for example
>> unicodeobject.c to have an idea of what horrible macros mean.
>>
>> I'm in favor of dropping C89 support and require at least C99. There is now
>> C11, it's time to drop the old C89.
>> http://en.wikipedia.org/wiki/C11_%28C_standard_revision%29
>
> well, requiring C99 is another discussion which I'm not so keen on instigating :)
> As you point out, most of our target platforms probably do support inline
> already.  My question is more of the nature: What about those that don't support
> inline, is there any harm in defaulting to "static" in that case and leave the inlining
> to the optimizer on those platforms?

I agree, modern compilers will inline quite aggressively, so declaring a function static
is as good as declaring it inline, provided the function is small.
Static functions are a lot easier to read and maintain than LOUD_BUT_UNTYPED_MACRO(x)  :)

Cheers,
Mark.
More information about the Python-Dev mailing list

RetroSearch 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