No, you couldn't, unless you could use such an address to call the
function with arbitrary arguments.
I'm clearly not being clear here. There's (probably) an address at
which the inlined code starts, but it would be useless for the
compiler to give you that as the address of the function, because you
couldn't use it to call the function. I didn't mean it would be
possible for a conforming C compiler to do such a thing.
I should just have left out "usefully" in my original comment:
The previous poster was probably thinking (correctly) that it's not
usefully possible to take the address of a function that has been
inlined.
I only put it in because I was expecting some pedant to say "it is
*possible* to take the address, you just can't call it".[/QUOTE]
Ok, I see what you mean -- but I think you were mistaken in your
original assumption.
Here's what Paul Hsieh ("websnarf") wrote:
| Keep in mind that "static" function declarations are usually basically
| equivalent to what is intended by C99's "inline". For serious
| compilers, there should be no effective difference between the two
| (inline further asserts that taking the address of the function is
| illegal, however, a static function whose address *isn't* taken (which
| it can always determine because it *is* static) becomes equivalent in
| functional status.)
A couple of followups later, you wrote:
| The previous poster was probably thinking (correctly) that it's not
| usefully possible to take the address of a function that has been
| inlined. If you take the address of a function declared inline, the
| compiler will have to produce an out-of-line version as well.
I'm reasonably sure that Paul *meant* simply that the standard
disallows taking the address of a function to which "inline" has been
applied, just as it does for a variable to which 'register has been
applied. (He was mistaken, though the standard easily *could* have
imposed this restriction, and it arguably would have made some sense.)
Taking the address of an inlined expansion of a function doesn't make
much sense at all, though I suppose it would be theoretically
possible. By anticipating a point that nobody actually made, I'm
afraid you've managed (quite unintentionally, I'm certain) to create
the very confusion you were trying to prevent.