"Chris Antos" wrote:
> i don't think you can do that without also at least declaring struct
> ListType, such as:
>
> struct ListType;
> typedef struct ListType *ListPtr;
>
> but yes, that's exactly what i was trying to point out.
Nope, it's perfectly legal. The following code compiled and ran for
all the compilers I've got access to (GCC + the system compilers for
HP-UX, IRIX, AIX and Solaris):
typedef struct foo FooType;
typedef FooType *FooPtr;
int
main(void)
{
FooPtr a;
a = 0;
return 0;
}
It'd work just as well if you skipped the intermediate 'FooType' step
and just did:
typedef struct foo *FooPtr;
Of course, there's no way to declare something as 'FooType', but
that's the point, isn't it?
- Re: OS header files; const in prototypes, especially in type... Bob Ebert
- Re: OS header files; const in prototypes, especially in... Chris Antos
- Re: OS header files; const in prototypes, especially in... Dave Glowacki
- Re: OS header files; const in prototypes, especially in... Chris Antos
- Re: OS header files; const in prototypes, especially in... Dave Glowacki
- Re: OS header files; const in prototypes, especially in... Scott Johnson
- Re: OS header files; const in prototypes, especially in... Jason Dawes
- Re: OS header files; const in prototypes, especially in... rflores
- Re: OS header files; const in prototypes, especially in... Mihaela Ignat
