forward declaration in c
Hello
I can't to find fine syntax for cyclic declaration:
.
typedef Node *(*TransformColumnRef_hook_type) (ParseState *pstate,
ColumnRef *cref);
typedef struct ParseState
{
struct ParseState *parentParseState; /* stack link */
const char *p_sourcetext; /* source text, or NULL if not
available */
List *p_rtable; /* range table so far */
List *p_joinexprs; /* JoinExprs for RTE_JOIN
p_rtable entries */
List *p_joinlist; /* join items so far (will
become FromExpr
*
node's fromlist) */
List *p_relnamespace; /* current namespace for relations */
List *p_varnamespace; /* current namespace for columns */
List *p_ctenamespace; /* current namespace for common
table exprs */
List *p_future_ctes; /* common table exprs not yet
in namespace */
List *p_windowdefs; /* raw representations of
window clauses */
Oid *p_paramtypes; /* OIDs of types for
$n parameter symbols */
int p_numparams; /* allocated size of
p_paramtypes[] */
int p_next_resno; /* next targetlist
resno to assign */
List *p_locking_clause; /* raw FOR UPDATE/FOR
SHARE info */
Node *p_value_substitute; /* what to replace
VALUE with, if any */
bool p_variableparams;
bool p_hasAggs;
bool p_hasWindowFuncs;
bool p_hasSubLinks;
bool p_is_insert;
bool p_is_update;
Relation p_target_relation;
RangeTblEntry *p_target_rangetblentry;
TransformColumnRef_hook_type transformColumnRef_hook;
} ParseState;
with empty declaration typedef struct ParseState;
I got errors:
In file included from ../../../src/include/catalog/heap.h:18,
from parse_clause.c:20:
../../../src/include/parser/parse_node.h:79: warning: useless storage
class specifier in empty declaration
../../../src/include/parser/parse_node.h:81: error: expected ‘)’
before ‘*’ token
../../../src/include/parser/parse_node.h:109: error: expected
specifier-qualifier-list before ‘TransformColumnRef_hook_type’
thank you
Pavel
On Mon, May 25, 2009 at 01:20:05PM +0200, Pavel Stehule wrote:
Hello
I can't to find fine syntax for cyclic declaration:
If you mean forward declaraions of a type, just:
struct ParseState
will do, then:
typedef Node *(*TransformColumnRef_hook_type) (struct ParseState *pstate,
ColumnRef *cref);
With the "struct" keyword added.
with empty declaration typedef struct ParseState;
It might work with:
typedef struct ParseState ParseState;
But then you can't use typedef in the actual declaraion (AFAIK you can
only forward declare structs, enums and such, but not typedefs).
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Please line up in a tree and maintain the heap invariant while
boarding. Thank you for flying nlogn airlines.
2009/5/25 Martijn van Oosterhout <kleptog@svana.org>:
On Mon, May 25, 2009 at 01:20:05PM +0200, Pavel Stehule wrote:
Hello
I can't to find fine syntax for cyclic declaration:
If you mean forward declaraions of a type, just:
struct ParseState
will do, then:
typedef Node *(*TransformColumnRef_hook_type) (struct ParseState *pstate,
ColumnRef *cref);With the "struct" keyword added.
with empty declaration typedef struct ParseState;
yes, good advice
thank you
Pavel
Show quoted text
It might work with:
typedef struct ParseState ParseState;
But then you can't use typedef in the actual declaraion (AFAIK you can
only forward declare structs, enums and such, but not typedefs).Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/Please line up in a tree and maintain the heap invariant while
boarding. Thank you for flying nlogn airlines.-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)iD8DBQFKGoOMIB7bNG8LQkwRApDrAKCKLSPWKoDVu0xemsbijTef/wTo3QCgjzAM
WPgB/FGqCXiANvrEM+rePfA=
=nRZn
-----END PGP SIGNATURE-----