Re: Prevent warnings on forward struct declaration
Re: Prevent warnings on forward struct declaration
- Subject: Re: Prevent warnings on forward struct declaration
- From: David Fang <email@hidden>
- Date: Sat, 26 Nov 2005 03:07:50 -0500 (EST)
Hi,
> typedef void (*SomeCompletionProcPtr) (struct SomeControlBlock *dInfo);
>
> typedef struct SomeControlBlock
> {
> --- more stuff here ---
> }
> SomeControlBlock, *SomeControlBlock;
>
> So I have a struct and one of its variables is a pointer to a function whose
> parameter is a pointer to the struct.
> The forward declaration (with "struct" in the param list) works, but Xcode
> generates a warning:
>
> warning: its scope is only this definition or declaration, which is probably
> not what you want
> warning: 'struct SomeControlBlock' declared inside parameter list
This doesn't answer your question about turning off the warning,
but FWIW, you could just forward declare:
struct SomeControlBlock;
by itself before everything.
You can even typedef a forward-declared struct (before it's defined):
typedef struct SomeControlBlock SomeControlBlock;
(I'm assuming compiling "C" and not "C++".)
(and I just happen to be fixing things like this at the moment with
someone else's legacy source code...)
David Fang
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden