Search Postgresql Archives

Re: C++ User-defined functions

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

 



Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> writes:
> 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.

The other half of the problem is that most user-written functions have
some reason to call functions in the core backend.  If any of those
might throw an error then you have to do the reverse mapping too (catch
the longjmp, throw an exception, catch that back at your exit point...).
Otherwise your exception cleanup doesn't happen, which makes the whole
thing a bit useless.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux