• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Prevent warnings on forward struct declaration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Prevent warnings on forward struct declaration
      • From: Trygve Inda <email@hidden>
References: 
 >Prevent warnings on forward struct declaration (From: Trygve Inda <email@hidden>)

  • Prev by Date: Prevent warnings on forward struct declaration
  • Next by Date: Re: Prevent warnings on forward struct declaration
  • Previous by thread: Prevent warnings on forward struct declaration
  • Next by thread: Re: Prevent warnings on forward struct declaration
  • Index(es):
    • Date
    • Thread