typedef struct forward declaration

I've google a bit about this and couldn't find an answer. Actually I read that it can't be done.

Basically I've defined the following structure and typedef it as follows.

stuct Name {
};

typdef struct Name Name.

and right after it, defined some API that use it.

void blabla(Name* param);
etc...

Now, I'm developing a C++ class which methods use that "object", but I can't forward declare that structure, and including the header in the in header class seems dead wrong to me and I want to avoid it.

What's the best way to proceed ?

Thanks in advance,
S.

In C++, the header is typically where this sort of thing goes.

Try this:

typedef struct tmpname {
int a, b;
struct tmpname *next;
...
} Name;

void foo( Name *p )
{
}

I'm sorry, but I don't get what you mean.

typedef struct name {
	int x ;
} name ;

void blabla (name * param) ;

good luck, and success !
alexandre botao
Alexandre V. R. Botao | Unix, C/C++, Shell, LDAP, SSL/TLS, SSH, Perl, Java, Python, Security, ...

It looks like it worked.

Could you please explain or point me to an explanation of this?

Thanks,
S.

1) typedef has the form:

typedef known_type new_name ;

eg.

typedef   char        octet ;
typedef   long long   bigtype ;

2) the trick here is that known_type can be a struct declaration !
eg.

struct mystruct {
   int x ;
} ;

3) when you combine these concepts, you get the code I posted previously ;

ok ?

good luck, and success !
alexandre botao
http://**********