Re: forward declaration in c - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: forward declaration in c
Date
Msg-id 20090525113956.GD15638@svana.org
Whole thread Raw
In response to forward declaration in c  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: forward declaration in c  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
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/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: forward declaration in c
Next
From: Pavel Stehule
Date:
Subject: Re: forward declaration in c