ISO/ IEC JTC1/SC22/WG14 N784

SC22/WG14 N784


Additional flexibility for inlining implementations
Clive D.W. Feather
clive@demon.net
1997-10-21


Abstract
========

The current draft allows external linkage functions to be inlined only as
part of a direct call. This proposal relaxes the restriction to allow
indirect inlining.


Discussion
==========

The current draft allows external linkage functions to be inlined only as
part of a direct call. If this restriction were relaxed, then an intelligent
implementation could do some kinds of indirect inlining, such as inlining
a call to the comparison function within qsort().


Proposal
========
[References are to draft 11 pre 3.]

In 6.5.4 "Function-specifiers" paragraph 8, change:

    ..., which a translator may use to implement any call to the
    function in the same translation unit. It is unspecified whether
    a call to the function uses the inline definition or the external
    definition.

to:

 |  ..., which a translator may use to implement any reference to the
    function in the same translation unit. It is unspecified whether
 |  a call to the function [*] uses the inline definition or the external
    definition.

    [*] In particular, if the address of an inline function is taken and
    then passed to another translation unit, a call using the address
    might call the version in the inline definition.