• 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: Block variable warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Block variable warnings


  • Subject: Re: Block variable warnings
  • From: David Dunham <email@hidden>
  • Date: Fri, 25 Mar 2011 21:20:04 -0700

>>> /Users/david/iKoDP/KoDP/Classes/AdviceView.mm:358:0 /Users/david/iKoDP/
>>> KoDP/Classes/AdviceView.mm:358: warning: declaration of 'b' shadows a
>>> previous local
>>> /Users/david/iKoDP/KoDP/Classes/AdviceView.mm:275:0 /Users/david/iKoDP/
>>> KoDP/Classes/AdviceView.mm:275: warning: shadowed declaration is here
>>>
>>> I don't get these if I use Xcode 4.
>>>
>>> How can I suppress these warnings when using Xcode 3.2.x?
>>
>> #pragma GCC diagnostic ignored "-Wshadow"
>>
>> ...code...
>>
>> #pragma GCC diagnostic warning "-Wshadow"

Thanks Sean, that seems to do the trick.

> I have always been rather wary of this, and have never confirmed to my satisfaction whether this is simply a spurious warning or an indication that the compiler has "misunderstood" my source code and hence potentially generated incorrect code from it (I've reported this and various similar bugs...). If it crops up I tend to take that as a cue to simplify what I am doing, and potentially remove that use of a block entirely, just to be safe...

I don't really see how to avoid using a block for animation (the alternative is too painful to contemplate), and I wasn't clear enough that not only do I not get the warnings if I use Xcode 4, but the code work fine in Simulator. (And it works fine when I build it for ARM using Xcode 3.2.6.)

I guess I hadn't really noticed that all these are in .mm files.

David Dunham     A Sharp, LLC     http://a-sharp.com

 _______________________________________________
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

References: 
 >Re: Block variable warnings (From: Jonathan Taylor <email@hidden>)

  • Prev by Date: Re: Why does XCode 4 always open files up to maximum size?
  • Next by Date: Re: Xcode 4 Console Pane
  • Previous by thread: Re: Block variable warnings
  • Next by thread: Xcode 4 suddenly throwing "error_category()to global weak symbol vtable"
  • Index(es):
    • Date
    • Thread