Re: SPI-header-files safe for C++-compiler - Mailing list pgsql-patches

From Jacob Rief
Subject Re: SPI-header-files safe for C++-compiler
Date
Msg-id 20070628100837.172990@gmx.net
Whole thread Raw
In response to Re: SPI-header-files safe for C++-compiler  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: SPI-header-files safe for C++-compiler
List 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
oftenseen 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
somethingvery 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
ofspi.h and trigger.h shall never, ever even think about using a C++ compiler in their projects, I will stop any
discussionhere 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: http://www.gmx.net/de/go/freemail

pgsql-patches by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Load Distributed Checkpoints, final patch
Next
From: Heikki Linnakangas
Date:
Subject: Doc update for pg_start_backup