pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Serge Rielau <srielau@gmail.com>
To: Craig Ringer <craig@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: dandl <david@andl.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [GENERAL] C++ port of Postgres
Date: Wed, 17 Aug 2016 07:07:49 -0700
Message-ID: <F3B97D95-6DF0-4B38-8ED4-F4F8CA7BEB88@gmail.com> (raw)
In-Reply-To: <CAMsr+YFKuY+H+DZ6Ysx2PPaJAp4gCs5fZivrj3y4HNr+OKUdKw@mail.gmail.com>
References: <CAMjNa7e7E81T3NqoReixYxrCFQpfWd+Mht0NhetW3bJB=Gs7Og@mail.gmail.com>
	<007001d1f786$d903fa90$8b0befb0$@andl.org>
	<00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz>
	<f7682c24-4271-1ff5-d963-053ecb0fce40@BlueTreble.com>
	<CA+Tgmoa8=kMNkOGDCZYR-L_PAoQ2Vdb9EmSV+=7pRv+J3u7_CA@mail.gmail.com>
	<27271.1471366764@sss.pgh.pa.us>
	<CA+TgmoZYjv9xWub1kbcSWC_RPg3qB_ELNBhQOki1g387JMyoVg@mail.gmail.com>
	<002401d1f820$a616f7a0$f244e6e0$@andl.org>
	<20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de>
	<003701d1f829$d2308dc0$7691a940$@andl.org>
	<20160817014944.hkfd46ipmj4rh76y@alap3.anarazel.de>
	<CAMsr+YFKuY+H+DZ6Ysx2PPaJAp4gCs5fZivrj3y4HNr+OKUdKw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>


> On Aug 16, 2016, at 10:16 PM, Craig Ringer <craig@2ndquadrant.com> wrote:
> 
> On 17 August 2016 at 09:49, Andres Freund <andres@anarazel.de <mailto:andres@anarazel.de>> wrote:
>  
> 
> You need to include the files surrounded by extern "C" { }.
> 
> I'd really like to adopt the convention used by many libraries etc of doing this automatically - detecting a c++ compiler in the preprocessor and wrapping in "extern "C"" .
> 
> Having the codebase c++-clean enough to compile with a c++ compiler seems to be the easiest way to maintain that, but means more "extern "C"" droppings in the .c files, not just the headers. Still, pretty ignoreable.
> 
Big +1 here,
Just having community code compilable with a C++ compiler out of the box would go a long way.

Beyond that, on my end I have been working with PG now for a year and a half and here is a quick list of what I sorely miss from my C++ days:
* Overloading of functions (same as in SQL) keeps naming clean
* Named parameters (same as SQL) keeps code readable
* Adding new function parameters with defaults so I don’t need to pass in NULL, 0, … at 20 places (again supported in SQL)
* Member functions greatly help organize code
* simple inheritance (as emulated today in node types)

At my old employer we used C++ for the DBMS in various degrees in different components.
That degree was agreed upon in coding standards, so we could pick what we like about C++ and blacklist what we didn’t.
E.g. C style exception handling was prohibited
Default memory management (new) was prohibited.
Instead new() was overloaded and hooked into the DBMS memory manager.
I see no reason why this couldn’t be done in PG.

I can’t comment of compiling on a Rasperry PI, but know that my former DBMS code compiled and ran on Windows, Linux, AIX, Sun, HP, and Mac.

But again, just having the community code compile so proprietary (for now) enhancements could be written in C++ would be huge.


Cheers
Serge
  =

view thread (76+ messages)  latest in thread

Message-ID: <F3B97D95-6DF0-4B38-8ED4-F4F8CA7BEB88@gmail.com>
Permalink:  ../F3B97D95-6DF0-4B38-8ED4-F4F8CA7BEB88@gmail.com/
Also on:    postgresql.org/message-id/F3B97D95-6DF0-4B38-8ED4-F4F8CA7BEB88@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: srielau@gmail.com, craig@2ndquadrant.com, andres@anarazel.de, david@andl.org, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [GENERAL] C++ port of Postgres
  In-Reply-To: <F3B97D95-6DF0-4B38-8ED4-F4F8CA7BEB88@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox