Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!munnari!otc!mikem From: mikem@otc.OZ (Michael Mowbray) Newsgroups: comp.lang.c++ Subject: Re: virtual functions. No fault found. Message-ID: <57@otc.OZ> Date: Sat, 13-Dec-86 23:51:59 EST Article-I.D.: otc.57 Posted: Sat Dec 13 23:51:59 1986 Date-Received: Tue, 16-Dec-86 01:30:56 EST References: <8325@watrose.UUCP> Distribution: comp Organization: O.T.C. Systems Development, Australia Lines: 57 In article <8325@watrose.UUCP>, gjditchfield@watrose.UUCP (Glen Ditchfield) writes: > C++ seems to be generating code that cc won't accept. Am I doing something > wrong? > > [ .. deleted ..] > > void f(employee* ll) > { > for (; ll; ll=ll->next) > ll->print(); > } > > [ .. deleted .. ] > > When I run it through C++, I get these error messages from cc: > "virt.cc", line 22: illegal function > "virt.cc", line 22: illegal function > where line 22 is "ll->print()" in function f. (The local support people > have set things up so that C++ files must have names ending in .cc.) > > C++'s output, slightly prettified, looks like this: > ---------------- > #line 1 "virt.cc" > > /* <> */ > // ... > > #line 20 "virt.cc" > int f (_auto_ll )struct employee *_auto_ll ; > { > for(;_auto_ll ;_auto_ll = _auto_ll -> _employee_next ) > #line 22 "virt.cc" > (*(((int (*)())(*_auto_ll -> _employee__vptr )))) > (*(((int (*)())(*_auto_ll -> _employee__vptr ))))( _auto_ll) ; > }; > I ran this, and the C-code generated was something like: int f(_auto_ll) struct employee *_auto_ll; { for (; _auto_ll; _auto_ll = _auto_ll->_employee_next) (*(((int (*)())(*_auto_ll -> _employee__vptr ))))( _auto_ll); } - which compiles fine. I'm running release 1.1 on Pyramid 90X. ( <> ). There must be a subtle bug in the port (?). What machine is being used? Mike Mowbray Systems Development Overseas Telecommunications Commission (Australia) UUCP: {seismo,mcvax}!otc.oz!mikem ACSnet: mikem@otc.oz