Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B1043475DB4 for ; Tue, 3 Dec 2002 13:25:58 -0500 (EST) Received: from oxmail.ox.ac.uk (oxmail4.ox.ac.uk [163.1.2.33]) by postgresql.org (Postfix) with ESMTP id BE35D4758E1 for ; Tue, 3 Dec 2002 13:25:57 -0500 (EST) Received: from smtp1.herald.ox.ac.uk ([163.1.0.247]) by oxmail.ox.ac.uk with esmtp (Exim 4.10) id 18JHk5-0006Xv-04 for pgsql-interfaces@postgresql.org; Tue, 03 Dec 2002 18:25:57 +0000 Received: from fgu028.anat.ox.ac.uk ([163.1.29.28] helo=FGU028) by smtp1.herald.ox.ac.uk with esmtp (Exim 3.35 #1) id 18JHk5-0005UL-00 for pgsql-interfaces@postgresql.org; Tue, 03 Dec 2002 18:25:57 +0000 Reply-To: From: "Llew Sion Goodstadt" To: Subject: Re: libpqxx testers needed! Date: Tue, 3 Dec 2002 18:25:57 -0000 Message-ID: <00f901c29af9$6c3f30d0$1c1d01a3@FGU028> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <20021203010907.GD1385@localhost> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/7 X-Sequence-Number: 3420 One thing I am curious about is why strings are passed by value instead of by constant reference. Even granted that many standard library vendors *in the past* used COW reference counting implementations of std::string to minimize the cost of copying, this surely is still an unwarranted additional cost. E.g. libpqxx-1.2.2\src\connection.cxx:427 Instead of: void pqxx::Connection::BeginCopyRead(string Table) Should be: void pqxx::Connection::BeginCopyRead(const string& Table) { Result R( Exec(("COPY " + Table + " TO STDOUT").c_str()) ); R.CheckStatus(); } Of course if you are going to change the string anyway inside the body of the function, pass by const reference is misleading for both the compiler and the user, so pass by value would be justified. E.g. if the above example had been something like void pqxx::Connection::BeginCopyRead(string Table) { Table = "COPY " + Table + " TO STDOUT"; Result R( Exec(Table.c_str()) ); R.CheckStatus(); } I have found few of these cases in libpqxx. Leo Goodstadt MRC Functional Genetics Unit OXFORD OX1 3QX