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: 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 20:29:45
Message-ID: CAM3SWZSu+++ZvHdHst71fSKdLON5GMo-2L_Lk2mN5QvBmuBNBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Aug 16, 2016 at 9:59 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I think this might have advantages purely from the standpoint of new
> compilers possibly offering useful warnings we don't get now. But
> if we only go this far, I'm pretty dubious that it really helps people
> to develop extensions in C++. Almost invariably, if you ask *why* they
> want to do that, you'll get an answer involving C++ libraries that are
> not going to play very nice with our error handling or memory management
> conventions.

FWIW, it's not uncommon to opt-out of C++ exceptions entirely, for
various reasons. For example, the Google C++ style guide forbids it
(if only for historical reasons), as does the GCC style guide (since
GCC was a C program until several years ago [1]). Sometimes, these
third party libraries that mandate the use of exceptions do indeed
create significant headaches for Postgres, compatibility-wise, but
that isn't a given.

IMV, it would be useful to use C++ classes (and even template classes)
for a small number of data structures, while still largely adhering to
earlier practices (this is what GCC did). Specifically, a few modules
such as StringInfo, could be made to follow the RAII/scope bound
resource management usefully, which doesn't seem incompatible with
memory contexts. However, this doesn't seem terribly exciting to me.

[1] https://lwn.net/Articles/542457/
--
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message support-tiger 2016-08-16 20:32:54 Re: Postgres Pain Points: 1 pg_hba conf
Previous Message Andres Freund 2016-08-16 20:29:29 Re: [GENERAL] C++ port of Postgres

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-08-16 20:36:19 Re: [GENERAL] C++ port of Postgres
Previous Message Andres Freund 2016-08-16 20:29:29 Re: [GENERAL] C++ port of Postgres