develooper Front page | perl.perl5.porters | Postings from August 2019

macros v. inline functions

Thread Next
August 12, 2019 11:34
macros v. inline functions
Message ID:
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.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About