Path: utzoo!utgpu!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!agate!bionet!csd4.milw.wisc.edu!bbn!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-vax!waldemar From: waldemar@mit-vax.LCS.MIT.EDU (Waldemar Horwat) Newsgroups: comp.lang.c++ Subject: Type Compatibility Message-ID: <5485@mit-vax.LCS.MIT.EDU> Date: 20 Jan 89 22:53:17 GMT Organization: MIT LCS, Cambridge, MA Lines: 42 Sender: Reply-To: waldemar@mit-vax.UUCP (Waldemar Horwat) Followup-To: Distribution: Organization: MIT Laboratory for Computer Science, Cambridge Keywords: Given the declarations below, which of the following seven statements (numbered 1, 2, 4, 5, 6, 7, and 8) are acceptable in a "portable" C++ program? Specifically, I am trying to clarify the following issue: If a pointer to B can be passed to a function that takes a pointer to A, then can a pointer to a pointer to B be passed to a function that takes a pointer to a pointer to A? What if A is void? I'd also be interested in hearing what real compilers do with the following code. struct A {int x;}; struct B:A {int y;}; extern void f1(void *); extern void g1(A *); extern void i1(A &); extern void f2(void **); extern void g2(A **); extern void h2(void *&); extern void i2(A *&); B b,*pb,**ppb; void test() { f1(pb); //1 g1(pb); //2 i1(b); //4 f2(ppb); //5 g2(ppb); //6 h2(pb); //7 i2(pb); //8 } Waldemar Horwat Internet: waldemar@vx.lcs.mit.edu