Re: C++ User-defined functions

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: George Oakman <oakmang(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: C++ User-defined functions
Date: 2009-03-10 02:37:40
Message-ID: 49B5D274.1050201@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

> One thing you've got to be really wary of is C++ exceptions,
> which tend not to interoperate nicely with PG's longjmp-based error
> handling.

Hmm, that does sound problematic. You can always build with
-fno-exceptions (gcc; I think other compilers offer related options) and
adopt Pg's error handling scheme instead, though.

In general it's possible to use exceptions in C++ code that's being
called from C so long as you make sure you catch all possible exceptions
at the C/C++ interface point.

> My own advice is to think twice about how badly your function needs to
> be C++ rather than plain C.

Yep... unless you have to call C++ libraries or the like I'd be
reluctant to take all the possible bother on board. That's despite
personally having a strong preference for C++.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-03-10 02:42:39 Re: C++ User-defined functions
Previous Message Mike Charnoky 2009-03-10 02:21:25 Re: intermittant performance problem