Writing triggers in C++
| От | Jacob Rief | 
|---|---|
| Тема | Writing triggers in C++ | 
| Дата | |
| Msg-id | 1171408978.5704.29.camel@ruben обсуждение исходный текст | 
| Ответы | Re: Writing triggers in C++ Re: Writing triggers in C++ | 
| Список | pgsql-hackers | 
I tried to write a trigger using C++. This requires to include the
following header-files:
extern "C" {
#include <postgres.h>
#include <executor/spi.h>
#include <commands/trigger.h>
#include <fmgr.h>
}
Unfortunately some of the included headers define some structs and
functions where a few identifiers are C++ keywords.
The compiler-directive 'extern "C"' does not help here, it just tells
the compiler not to mangle C-identifiers. 'extern "C"' does not rename
C++ keywords into something else. Therefore AFAIK, if someone wants to
include those headers files into a C++ program, the identifiers causing
problems have to be renamed manually.
For instance, Postgresql version 8.2.3
/usr/include/pgsql/server/nodes/primnodes.h:950:   List  *using;    /* USING clause, if any (list of String) */
'using' is a C++ keyword
/usr/include/pgsql/server/nodes/parsenodes.h:179:   Oid   typeid;    /* type identified by OID */
'typeid' is a C++ keyword
/usr/include/pgsql/server/nodes/parsenodes.h:249,265,401,943,1309:   TypeName   *typename;
'typename' is a C++ keyword
/usr/include/pgsql/server/utils/builtins.h:544:
extern char *quote_qualified_identifier(const char *namespace,
'namespace' is a C++ keyword
Is there any convention how to rename such identifiers? If I would
rename those identifiers (I simply would add an underscore to each of
them), would such a patch be accepted and adopted onto one of the next
releases? 
Regards, Jacob
		
	В списке pgsql-hackers по дате отправления: