• 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: Britt Durbrow <email@hidden>
  • Date: Tue, 02 Jun 2015 22:07:50 -0700

> On Jun 2, 2015, at 12:13 PM, Charles Srstka <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]

Hmm… I’ve never seen that warning actually be emitted by clang… so, thinking something was amiss, I just created a brand new project file (Cocoa app; Objective-C; not document based) with Xcode Version 6.3.2 (6D2105); and went looking for where to turn that on/off in the target build settings…  and I can’t find it. So, I then proceeded to add an int foo; declaration to the @interface of the app delegate — no warning emitted. In order to get it to show up I had to add it to the “Other C Flags” line under “Apple LLVM 6.1 - Custom Compiler Flags”.

>
>> 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.
>
> That doesn’t help if I’m looking at some code that someone else wrote, or code that I wrote 5 years ago, noticing a variable name being used somewhere, and having to hunt around for the declaration to figure out whether it’s a local variable, an instance variable, or something stupid like a global or something.
>

Um… why does it matter? If you go to add a variable declaration and you immediately get a warning… just pick a different name? Or use the symbol navigator to find it (it’s got a search box) ? Or remove the type from the declaration (so that it’s now just a symbol reference) and command-click it?

>>> On Jun 1, 2015, at 3:14 PM, Charles Srstka <email@hidden> wrote:
>>
>>>
>>> Non-underscored ivars vs. local variables, however, are not obvious at all, especially if the method is large.
>>
>> In modern versions of Xcode at least, if I don’t know exactly what I’m looking at, the answer is just a command-click away… :-)
>
> That can be handy, when it works. Sometimes it doesn’t (particularly when you’re using Swift, in which command-click usually just brings up an endless circular progress indicator).
>

I’m not using Swift; and probably won’t be any time soon; so I can’t speak to Xcode’s current stability with Swift code. However, in Objective-C I rarely have a problem; and when I do performing a clean-and-build cycle has made it go away.
_______________________________________________

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


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>)

  • 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: Re: Looking at self = [super init].
  • Index(es):
    • Date
    • Thread