From owner-freebsd-questions Thu Apr 4 22:46:21 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.acns.ab.ca (mail.acns.ab.ca [142.179.151.95]) by hub.freebsd.org (Postfix) with ESMTP id 4EF0B37B417 for ; Thu, 4 Apr 2002 22:46:18 -0800 (PST) Received: from colnta.acns.ab.ca (colnta.acns.ab.ca [192.168.1.2]) by mail.acns.ab.ca (8.11.6/8.11.3) with ESMTP id g356kAi45900; Thu, 4 Apr 2002 23:46:10 -0700 (MST) (envelope-from davidc@colnta.acns.ab.ca) Received: from colnta.acns.ab.ca (localhost [127.0.0.1]) by colnta.acns.ab.ca (8.12.2/8.11.3) with ESMTP id g356k2sn008574; Thu, 4 Apr 2002 23:46:02 -0700 (MST) (envelope-from davidc@colnta.acns.ab.ca) Received: (from davidc@localhost) by colnta.acns.ab.ca (8.12.2/8.12.2/Submit) id g356k2uO008573; Thu, 4 Apr 2002 23:46:02 -0700 (MST) Date: Thu, 4 Apr 2002 23:46:02 -0700 From: Chad David To: Edwin Groothuis Cc: questions@freebsd.org Subject: Re: C++ Question Message-ID: <20020404234602.A8554@colnta.acns.ab.ca> References: <20020404233047.A8398@colnta.acns.ab.ca> <20020405163951.E56548@k7.mavetju.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020405163951.E56548@k7.mavetju.org>; from edwin@mavetju.org on Fri, Apr 05, 2002 at 04:39:51PM +1000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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