Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!columbia!read.columbia.edu!kearns2 From: kearns2@read.columbia.edu (Steve Kearns) Newsgroups: comp.lang.c++ Subject: Re: default argument bug in 1.2! Message-ID: <6411@columbia.edu> Date: 24 Jul 89 18:46:08 GMT References: <503@gill.UUCP> <6409@columbia.edu> <1505@ns.network.com> Sender: news@columbia.edu Reply-To: kearns2@read.UUCP (Steve Kearns) Organization: Columbia University Department of Computer Science Lines: 53 >I have compiled a test case, and found that this does not seem to be >an error as simple as you have stated. The following complete program >works correctly and prints "bill != -1". > >--------------------------- >//test.c >#include > >class bar{ >public: > void foo(int joe, int bill= -1); >}; > >void bar.foo(int joe, int bill= -1) { > if (bill == -1) printf("bill == -1\n"); > else printf("bill != -1\n"); >} > >main() { > bar b; > b.foo(23,24); >} >---------------------------- > >Jim >hughes@network.com Actually, this program does demonstrate the bug on my copy of CC (#ident "@(#)cfront:CC 1.20"). And if I look at the C code it generates using CC -F -.i then I can see that bar::foo compiles to the following: #line 204 "test.c" char _bar_foo (_au0_this , _au0_joe , _au0_bill ) #line 202 "test.c" struct bar *_au0_this ; #line 204 "test.c" int _au0_joe ; #line 204 "test.c" int _au0_bill ; { #line 206 "test.c" printf ( (char *)"bill == -1\n") ; } ; I guess I need a later copy. If only I had a spare $20000... -steve