monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Typesafe VA_ARGS replacement for database::execute/


From: Nathaniel Smith
Subject: Re: [Monotone-devel] Typesafe VA_ARGS replacement for database::execute/fetch
Date: Fri, 20 Jan 2006 20:03:28 -0800
User-agent: Mutt/1.5.9i

On Fri, Jan 20, 2006 at 04:12:35PM +0100, Christof Petig wrote:
> I strongly feel that varargs is a bad choice for C++ programs, using
> your proposed % syntax is much cleaner (as with L() and boost::format).

He actually told me the same thing when I suggested going back to this
:-).  Maybe I agree with you guys... but I should say why I suggested
it.  The thing is that for an API like:
  query("blah") % foo % bar % baz
I feel rather uncomfortable unless we copy the foo/bar/baz strings
into the query object; there's no convention in general that the
string data should stay in scope longer than the query object, so we
need to make a local copy.  With arguments, there's more of a
convention that I can pass stuff by reference or by pointer and that
reference/pointer will stay alive until the call finishes.

Since we shovel hundreds of megabytes through this interface, reducing
copying seems worthwhile.  I guess we do always copy now, though, so
actually I guess I have no data on whether the win is valuable or not.
We spend a lot of time in sqlite, but I don't know where exactly.

-- Nathaniel

-- 
"But suppose I am not willing to claim that.  For in fact pianos
are heavy, and very few persons can carry a piano all by themselves."

This email may be read aloud.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]