failed to compile a C++ SPI function

From: Louis-David Mitterrand <cunctator(at)apartia(dot)ch>
To: pgsql-hackers(at)postgresql(dot)org
Subject: failed to compile a C++ SPI function
Date: 2000-10-01 08:11:02
Message-ID: 20001001101102.A16351@styx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Just for fun I changed the extension of my SPI function and trigger
source file from .c to .C and tried to compile it:

> g++ -g -Wall -I /usr/include/postgresql -fPIC -pedantic -c -o bid_control.o bid_control.C
> In file included from /usr/include/postgresql/nodes/relation.h:18,
> from /usr/include/postgresql/executor/spi.h:18,
> from bid_control.h:31,
> from bid_control.C:21:
> /usr/include/postgresql/nodes/parsenodes.h:871: parse error before `typename'

It seems the "typename" word used in the following structure is a
reserved word in C++. (and is appears colored like a type in Vim)

> /*
> * ParamNo - specifies a parameter reference
> */
> typedef struct ParamNo
> {
> NodeTag type;
> int number; /* the number of the parameter */
> TypeName *typename; /* the typecast */
^^^^^^^^^
> List *indirection; /* array references */
> } ParamNo;

Is it totally unreasonable try C++ in SPI programming?

Cheers,

--
Louis-David Mitterrand - ldm(at)apartia(dot)org - http://www.apartia.org

Isn't vi that text editor with two modes... one that beeps and one
that corrupts your file?" -- Dan Jocabson, on comp.os.linux.advocacy

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2000-10-01 08:13:12 Re: memory management suggestion
Previous Message Kristofer Munn 2000-09-30 17:39:42 Crash during vacuum analyze only...