Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2011 21:09:10 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        mdf@freebsd.org, Evans <brde@optusnet.com.au>, Bruce@freebsd.org, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: sizeof(function pointer)
Message-ID:  <CC5909A8-5A5D-4859-9769-132BF88B559E@xcllnt.net>
In-Reply-To: <20110531200652.3fd6fcbe@kan.dnsalias.net>
References:  <BANLkTimctcBWRrYVLyc-WLgePyCXqaPTGA@mail.gmail.com> <D541877D-0EE5-4EC3-9197-E9F2A7A10AC1@bsdimp.com> <20110531200652.3fd6fcbe@kan.dnsalias.net>

next in thread | previous in thread | raw e-mail | index | archive | help

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@xcllnt.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CC5909A8-5A5D-4859-9769-132BF88B559E>