Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!rochester!cornell!peierls From: peierls@svax.cs.cornell.edu (Tim Peierls) Newsgroups: comp.lang.c++ Subject: Re: Pointer conversion macro brainteaser Message-ID: <43906@cornell.UUCP> Date: 30 Jul 90 18:53:48 GMT References: <43645@cornell.UUCP> <56042@microsoft.UUCP> Sender: nobody@cornell.UUCP Reply-To: peierls@svax.cs.cornell.edu (Tim Peierls) Distribution: comp Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 25 >In article <43645@cornell.UUCP> peierls@cs.cornell.edu (Tim Peierls) writes: >|The question is, for all you spec hackers, under what conditions is >|this macro guaranteed by E&S to work? ... >| >|#define bp2dp(B,D,p) ((p)?((D*)(((char*)(p))+1-((size_t)(B*)(D*)(void*)1))):0) >|It works for cfront 2.0 and probably everywhere else. > In article <56042@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: >I disagree with both the first part and the second part of this statement. > >When I tried this macro on a cfront 2.0 derivative with B a virtual base >class of D ... > I did say in my original posting that D had to be derived non-virtually from B. I was looking for a characterization of implementations where this macro fails rather than an enumeration of implementation dependent behavior, but perhaps what you are saying is that no useful characterization exists beyond such an enumeration. I'll buy that. Name : Tim Peierls Mail : peierls@svax.cs.cornell.edu Scotch : Laphroaig