Re: [notmuch] Segfault searching for tags

Subject: Re: [notmuch] Segfault searching for tags

Date: Sat, 21 Nov 2009 01:32:34 +0100

To: Adrian Perez de Castro,


From: Carl Worth

On Fri, 20 Nov 2009 20:03:00 +0100, Adrian Perez de Castro <> wrote:
> Well, of course you are right, it is an overloaded operator, which
> (unfortunately, IMHO) looks like a pointer dereference. That is exactly
> one of the things that I find more confusing about C++: it has features
> like operator overloading which look cool initially, but that in the end
> imply more complexity than needed. I can understand why you decided to
> wrap Xapian with a plain C API :)

I'm glad you agree.

Though I should mention that I earned my summer's salary during an
internship once by solving a performance problem that had dodged the
engineers on the project, (since they overlooked an overloaded array
subscript operator on a std::string class as something that could be
expensive---profiling made it obvious, and a temporary copy to a real
array with a real subscript fixed the bug).

So I can't say that operator overloading never helped me. But I know I
left that internship determined not to use it myself.

> I can confirm that this patch avoids the segfault in my case, too. Thanks
> a lot for the quick fix.

Excellent. I'm glad to hear it worked for you.

I'm sorry that the bug was there, since this was a regression that's
come back once or twice now. The project is overdue for a test suite