Date: Thu, 4 Apr 2002 23:46:02 -0700 From: Chad David <davidc@acns.ab.ca> To: Edwin Groothuis <edwin@mavetju.org> Cc: questions@freebsd.org Subject: Re: C++ Question Message-ID: <20020404234602.A8554@colnta.acns.ab.ca> In-Reply-To: <20020405163951.E56548@k7.mavetju.org>; from edwin@mavetju.org on Fri, Apr 05, 2002 at 04:39:51PM %2B1000 References: <20020404233047.A8398@colnta.acns.ab.ca> <20020405163951.E56548@k7.mavetju.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 05, 2002 at 04:39:51PM +1000, Edwin Groothuis wrote: > On Thu, Apr 04, 2002 at 11:30:47PM -0700, Chad David wrote: > > I realize this isn't really a FreeBSD question, but... > > > > I'm porting a bunch of code to FreeBSD and I've run into the following: > > > > int do_xyz(String &s1, String &s2 = String(), String &s3 = String()); > > > > g++ complains fails with the following: > > > > file.h:100: invalid type `String' for default argument to `String &' > > Not bothered by any knowledge, but what if you remove the assignments > from the prototyping? > > int do_xyz(String &s1, String &s2, String &s3); > > And then let the function definition the same (i.e. with the assignments). Then it works just fine. What the original programmer did was implement a database query class that takes the arguments to the query as optional parameters to the method. Obviously there are ways the interface could have been designed better, but that just isn't going to happen right now. Instead, I need to find a way to make this work (if there is one!). -- Chad David davidc@acns.ab.ca www.FreeBSD.org davidc@freebsd.org ACNS Inc. Calgary, Alberta Canada Fourthly, The constant breeders, beside the gain of eight shillings sterling per annum by the sale of their children, will be rid of the charge of maintaining them after the first year. - Johnathan Swift To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020404234602.A8554>