Skip site navigation (1) Skip section navigation (2)

Re: SPI-header-files safe for C++-compiler

From: "Jacob Rief" <jacob(dot)rief(at)gmx(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, neilc(at)samurai(dot)com
Cc: pgsql-patches(at)postgresql(dot)org, andrew(at)dunslane(dot)net
Subject: Re: SPI-header-files safe for C++-compiler
Date: 2007-06-28 10:08:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Tom Lane wrote:
> Sure, but we don't break them just on a whim.  The bottom line here is
> whether we are going to make a real commitment to making C++ usable as
> a backend extension language --- and for the reasons I mentioned, that
> would entail a lot more than renaming a few identifiers.  It was already
> pointed out upthread that wrapping the inclusions in extern "C" {...}
> would fix the identifier part of the problem from the user side, so I do
> not see the point of fixing it from our side unless we are prepared to
> buy into a lot of other changes.  A C++ writer who is unwilling to add
> the extern{} bit around inclusions of C headers seems unlikely to "work
> with us" as regards to error-throwing conventions, for instance.

Adding an extern "C" arround the header files is not the problem, altough it would make life a little easier. I have often seen it in C-only header files, and it will do no harm to anybody using a C-only compiler.

The real problem are the C++-keyword used in spi.h and trigger.h
The C++ compiler (tested with gcc 4.1.0) even complains, if C++ keywords are used inside extern "C" { ... } blocks. The extern "C" only tells the compiler to switch off name-mangling - it does not allow any kind of plain-old C. With some drawbacks, it is perfectly legal to use C++ features inside an extern "C" block.

I am speaking about 1 function argument, where it absolutely doesn't matter, how it is named in a header files. 
And I am speaking about 5 struct member where it should not be a real problem for client libraries to rename them to something very similar.

If there is any chance to get this patch applied, I will of course regenerate it out of the HEAD-revision of the CVS repository. If there is any objection about the terminology of the renamed keywords, lets discuss.  If, however clients of spi.h and trigger.h shall never, ever even think about using a C++ compiler in their projects, I will stop any discussion here and patch each newer version of Postgres for my own private fork.

Regards, Jacob
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung:

In response to


pgsql-patches by date

Next:From: Susanne EbrechtDate: 2007-06-28 11:31:17
Subject: rename of a view
Previous:From: Heikki LinnakangasDate: 2007-06-28 09:14:05
Subject: Re: Load Distributed Checkpoints, final patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group