From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 1 04:47:16 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0240E106564A; Wed, 1 Jun 2011 04:47:16 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8F4088FC14; Wed, 1 Jun 2011 04:47:15 +0000 (UTC) Received: from dhcp-192-168-2-22.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6]) (authenticated bits=0) by mail.xcllnt.net (8.14.4/8.14.4) with ESMTP id p5149AVg018682 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 31 May 2011 21:09:16 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <20110531200652.3fd6fcbe@kan.dnsalias.net> Date: Tue, 31 May 2011 21:09:10 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <20110531200652.3fd6fcbe@kan.dnsalias.net> To: Alexander Kabaev X-Mailer: Apple Mail (2.1084) Cc: mdf@freebsd.org, Evans , Bruce@freebsd.org, freebsd-hackers Subject: Re: sizeof(function pointer) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 04:47:16 -0000 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