From -3114643813138764448
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,1e1d3ed27fda1584
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-04-04 20:00:27 PST
Path: gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!gatech!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!slip-1-49.ots.utexas.edu!user
From: jpcauvin@bongo.cc.utexas.edu (Roger L. Cauvin)
Newsgroups: comp.std.c++
Subject: Re: casting class function addresses
Followup-To: comp.std.c++
Date: 5 Apr 1994 03:00:27 GMT
Organization: Austin, Texas
Lines: 24
Message-ID: <jpcauvin-040494213746@slip-1-49.ots.utexas.edu>
References: <jpcauvin-020494115637@slip-15-2.ots.utexas.edu> <pjl.765206128@graceland.att.com> <41768@mindlink.bc.ca> <BWH.94Apr2122342@beach.cis.ufl.edu> <9404041757.AA28726@ses.com>
NNTP-Posting-Host: slip-1-49.ots.utexas.edu

In article <9404041757.AA28726@ses.com>, jamshid@ses.com (Jamshid Afshar)
wrote:

<Much stuff deleted about casting/coercing member function pointers>

> You can't just treat the block of memory where a particular object is
> stored like a block of memory containing another type of object (chars
> being an exception).

You can if the objects are of the same size and alignment.  If you can
prove that not all member function pointers have the same size and
alignment (an unlikely implementation even if theoretically possible), then
I will concede that coercion of member function pointers *could* result in
a run-time error in *some* compiler implementations.

Roger



P.S.  I picked up the distinction between casting and coercion from a C
book a while back.  I don't remember which book it was, though.  While
casting is a relatively safe, built-in means of conversion, coercion is a
conversion achieved by casting the address of an object and dereferencing
it.


