Re: server-side extension in c++

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Mark Cave-Ayland <mark(dot)cave-ayland(at)siriusit(dot)co(dot)uk>, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Igor <igor(at)carcass(dot)ath(dot)cx>, pgsql-general(at)postgresql(dot)org
Subject: Re: server-side extension in c++
Date: 2010-06-02 19:01:30
Message-ID: AANLkTinbK8bmTwKWxd71WZdzdhnsuFUIvAzhsXpHPDYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> It's good to have actual working code in production to bolster the
> case that the design is sound.
>
> How much work would it be to refactor libgeos_c to use a catch-all
> exception handler?
>

Well, they'd have to be using specific exception handlers to get the
error message. Perhaps they just have one per wrapper function like
this (assuming their exception objects ultimately inherit from
std::exception, which they all ought to):

...
char* error_string;
...
catch(const std::exception& e)
{
error_string = malloc(strlen(e.what()) + 1 );
if(error_string != NULL)
strcpy(error_string, e.what());
return false;
}
// They could add this catch-all, which we could fall back on to be on
the safe side
catch(...)
{
// We can't do anything except swallow - this could be anything
that doesn't inherit from std::exception
}

--
Regards,
Peter Geoghegan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2010-06-02 19:39:26 Re: create index concurrently - duplicate index to reduce time without an index
Previous Message Peter Geoghegan 2010-06-02 18:47:30 Re: server-side extension in c++