Xref: utzoo comp.lang.c:11738 comp.lang.c++:1403 Path: utzoo!attcan!uunet!wyse!vsi1!daver!athsys!stergios From: stergios@athsys.uucp (Stergios Marinopoulos) Newsgroups: comp.lang.c,comp.lang.c++ Subject: double pointer to function Message-ID: <107@cyclopes.UUCP> Date: 7 Aug 88 03:36:24 GMT Reply-To: stergios@athsys.UUCP (Stergios Marinopoulos) Organization: Xpert Xports Lines: 61 Can anyone figure out why the following code does not compile correctly? The first ?/: pair makes cc (sun 3.4) complain, while the second one does not. The only difference between the two is where the double pointer to functions get dereferenced. Don't think for a second I write code like this, it's the ouput of a C++ translator considerably simplified and cleaned up. struct A { int (**A_tablePtr )(); } ; void A_c (); void A_d () ; static int (*A__vtbl[])() = { (int(*)()) A_d , 0 }; typedef void (**PMF )(); extern int function1() ; extern int function2() ; void A_c (this , pmf ) struct A *this ; void *pmf ; { extern int flag ; /* code ccxx produces and error message cc spits out */ /* warning: illegal pointer combination: illegal types in : */ (*( (void (*)()) ( flag ? (*((void (**)())pmf )) : (this -> A_tablePtr [(((unsigned int )(*(((void (**)())pmf ))))) - 1]) ) ) ) ( this ) ; /* my hack to get it compiling */ /* no problems */ (**( (void (**)()) ( flag ? ((void (**)())pmf ) : (void (**)())(&(this -> A_tablePtr [(((unsigned int )(*(((void (**)())pmf ))))) - 1])) ) ) ) ( this ) ; } stergios marinopoulos sun!athsys!stergios