• 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: Looking at self = [super init].
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking at self = [super init].


  • Subject: Re: Looking at self = [super init].
  • From: Alex Zavatone <email@hidden>
  • Date: Wed, 03 Jun 2015 09:50:14 -0400

On Jun 3, 2015, at 9:02 AM, Alex Zavatone wrote:

>
> On Jun 2, 2015, at 3:13 PM, Charles Srstka wrote:
>
>> On Jun 1, 2015, at 11:43 PM, Britt Durbrow <email@hidden> wrote:
>>>
>> Variables declared in an @interface section trigger a compiler warning:
>>
>> warning: declaration of instance variables in the interface is deprecated [-Wobjc-interface-ivars]
>>
>>> Oh, and there’s a nifty warning that’s thrown as soon as you try to declare a local variable of the same name as an instance variable.
>>
>
> OK.  This is very important to me.  Where in the project can I set these flags so that they are project wide (or remove these flags) so that we get those warnings.  Project > Target > Build Settings - But under which section?
>
> I have a metric crapload of these to sort out as time permits and would LOVE to turn on these warning flags so I can bring this part of project up to 2012 standards, and then maybe eventually to 2015 standards.

AHA!

I couldn't find out how to add it through the Build Settings, (thanks terrible UI!), but If you want this in your project and your project has a .pch file, you can turn on the warning through a pragma and a clang diagnostic push by adding the code below to your .project wide header file.

/ AZ @@ 06030215 - Enable warnings on build for private interface variables manually declared in the @interface.
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wobjc-interface-ivars"

Thanks to Matt Thompson for his pragma article and the Clang docs.
http://nshipster.com/pragma/
http://clang.llvm.org/docs/UsersManual.html
http://fuckingclangwarnings.com/

Hope this is of use to some of you too.

Cheers,
Alex Zavatone
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Understanding the "declaration of instance variables in the interface is deprecated" warning.
      • From: Alex Zavatone <email@hidden>
References: 
 >Re: Looking at self = [super init]. (From: Dave <email@hidden>)
 >Re: Looking at self = [super init]. (From: Britt Durbrow <email@hidden>)
 >Re: Looking at self = [super init]. (From: Quincey Morris <email@hidden>)
 >Re: Looking at self = [super init]. (From: Charles Srstka <email@hidden>)
 >Re: Looking at self = [super init]. (From: Michael David Crawford <email@hidden>)
 >Re: Looking at self = [super init]. (From: Britt Durbrow <email@hidden>)
 >Re: Looking at self = [super init]. (From: Charles Srstka <email@hidden>)
 >Re: Looking at self = [super init]. (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Looking at self = [super init].
  • Next by Date: Re: Looking at self = [super init].
  • Previous by thread: Re: Looking at self = [super init].
  • Next by thread: Understanding the "declaration of instance variables in the interface is deprecated" warning.
  • Index(es):
    • Date
    • Thread