On Mon, Aug 12, 2019 at 10:55:31AM +0100, email@example.com wrote:
> This may be a topic worth considering at "the upcoming Perl 5 Core Hackathon".
> It would be useful to have guidelines for when we should prefer to add
> inline functions rather than macros.
> I suspect we could be using them a lot more than we do, but I don't know
> how many platforms still have insufficient capabilities to support them.
> Macros suffer from lack of types on arguments, risk of multiple evaluation,
> and opacity in debuggers. They also do not give compilers a choice whether
> to inline them, so may lead to less efficient code.
> Inline functions cannot do everything macros can, but where they can do
> what is needed the only drawback I know of is that on a platform that
> does not support them you'll get much less efficient code.
I expect that given how deep some of our macros are, switching to
inline functions in many cases could result in smaller code with
little performance impact, simply from the compiler not inlining
functions in UNLIKELY() code.
I should probably have used an inline function for SANE_ERRSV.