Re: [GENERAL] C++ port of Postgres

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, dandl <david(at)andl(dot)org>, Adam Brusselback <adambrusselback(at)gmail(dot)com>, Joy Arulraj <jarulraj(at)cs(dot)cmu(dot)edu>, kang joni <kangjoni76(at)gmail(dot)com>, Dmitry Igrishin <dmitigr(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: [GENERAL] C++ port of Postgres
Date: 2016-08-16 21:13:53
Message-ID: CAM3SWZR5SJOxCj2gjv8usLq35hGy0axL=kFUwvNK0cKSKxgb_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Aug 16, 2016 at 1:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2016-08-16 21:15:16 Re: [GENERAL] C++ port of Postgres
Previous Message Piotr Stefaniak 2016-08-16 21:08:28 Re: [GENERAL] C++ port of Postgres

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-08-16 21:15:16 Re: [GENERAL] C++ port of Postgres
Previous Message Piotr Stefaniak 2016-08-16 21:08:28 Re: [GENERAL] C++ port of Postgres