Re: Mostly Harmless: c++exception - patch 4 of 4

From: Kurt Harriman <harriman(at)acm(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Mostly Harmless: c++exception - patch 4 of 4
Date: 2008-12-05 09:20:18
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

(Re-sending just the fourth of four patches: c++exception)

These patches are based on CVS head in which the latest commit was
user: petere
date: Thu Dec 04 17:51:28 2008 +0000
summary: Default values for function arguments

4. c++exception

When C code calls C++ code, all C++ exceptions need to be caught
and fully contained within the C++ code. Exceptions should never
be thrown outward across the C/C++ frontier.

If an exception is not caught within C++ code, and the search for
a matching 'catch' bumps into a C stack frame, the result may be
platform dependent. On my platform (Linux/GCC), if this happens
in the postgres backend, the process terminates silently as if
abort() had been called.

With this patch, if --enable-cplusplus is configured,
PostgresMain defines a handler to intercept any uncaught C++
exception and convert it to a conventional PostgreSQL error of
FATAL severity. This allows the backend to clean up and report
the error before terminating.

Attachment Content-Type Size
c++exception.patch text/plain 3.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2008-12-05 09:24:06 Re: Mostly Harmless: Welcoming our C++ friends
Previous Message Kurt Harriman 2008-12-05 09:18:46 Re: Mostly Harmless: c++configure - patch 3 of 4