Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!math.fu-berlin.de!opal!kit!mfx From: mfx@cs.tu-berlin.de (Markus Freericks) Newsgroups: comp.lang.c++ Subject: problem with ** and *& Message-ID: Date: 8 Jun 91 13:05:13 GMT Sender: mfx@opal.cs.tu-berlin.de Distribution: comp Organization: Technical University of Berlin Lines: 46 I have a problem with either my AT&TC++ Rel2.1 or my understanding of C++ (:-) suppose two classes and a function class a { }; class b : public a { }; int fpp(a** x){ return 42; } main(){ b* bptr=new b(); fpp(&bptr); } now, my CC sez error: bad argument 1 type for fpp(): b ** ( a ** expected) why this ? if a 'b' can be used in the same places as an 'a' and a pointer to b can be used as a pointer to a; why doesn't this hold for a pointer to a pointer to b?? I got into this problem when trying to write a function int fpp(a*&x){ return 42; } main(){ b* bptr=new b(); fpp(bptr); } to which the compiler said warning: temporary used to initialize reference; no changes will be propagated to actual argument Thats really a funny one: the compiler knows that I probably want to change the argument (otherwise the function wouldn't take a reference, right?), but is somehow unable or unwilling to generate code that does this! Are these just problems of the implementation or do I suffer from some misunderstanding? Markus Freericks -- Markus Freericks phone: +49-30-4034110 Oranienburger Str. 142 email: mfx@opal.cs.tu-berlin.de 1000 Berlin 26 FRG or mfx%tubopal@DB0TUI11.BITNET