sizeof(function pointer)
Marcel Moolenaar
marcel at xcllnt.net
Wed Jun 1 04:47:16 UTC 2011
On May 31, 2011, at 5:06 PM, Alexander Kabaev wrote:
>> Usually it is different only on segmented architectures like 16-bit
>> x86.
>>
>
> Not so on ia64, where they have special function descriptor type.
Actually, no. On ia64 a function pointer has the same size as a
data pointer. It's just that a function pointer does not point
to the actual function (i.e. the first instruction of a function),
but to a function descriptor. The function descriptor contains the
address of the actual function and the value of the GP register
that needs to be set before entering the function.
As such, only virtual functions in C++ are impacted by this. The
function descriptor needs to be stored in the object instead of
the function pointer in that case.
FYI,
--
Marcel Moolenaar
marcel at xcllnt.net
More information about the freebsd-hackers
mailing list