Re: [GENERAL] C++ port of Postgres - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: [GENERAL] C++ port of Postgres
Date
Msg-id CAM3SWZR5SJOxCj2gjv8usLq35hGy0axL=kFUwvNK0cKSKxgb_g@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] C++ port of Postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Aug 16, 2016 at 1:59 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> FWIW, IIRC that's not true for gcc/glibc, because they IIRC use common
>> codepaths. But obviously that's not all-encompassing enough to rely on that.
>
> I wonder whether it'd be possible to implement the PG_TRY/CATCH macros
> to use C++ exceptions when building in C++.  This would probably mean
> that C and C++ builds would be incompatible as far as loadable extensions
> are concerned, because it'd amount to an ABI difference.  But maybe
> that's OK.  We could certainly have the PG_MODULE_MAGIC macro guard
> against the case.

Maybe.

I think that the best thing about C++ is the ability to encapsulate
and simplify some aspects of resource management quite well, which
necessitates reimplementing PG_TRY/CATCH. The worst thing about C++ is
that ABI compatibility is far messier. This makes a C++ port seem less
compelling to me than the idea first appears.

Note, for example, that ICU is implemented in C++, but still has C
stub functions, not necessarily for the exclusive benefit of C client
code.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Piotr Stefaniak
Date:
Subject: Re: [GENERAL] C++ port of Postgres
Next
From: Andres Freund
Date:
Subject: Re: [GENERAL] C++ port of Postgres