Re: forward declaration in c

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: forward declaration in c
Date: 2009-05-25 11:39:56
Message-ID: 20090525113956.GD15638@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-05-25 11:53:17 Re: forward declaration in c
Previous Message Pavel Stehule 2009-05-25 11:20:05 forward declaration in c