> On Jun 2, 2015, at 12:13 PM, Charles Srstka <cocoa...@charlessoft.com> 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 <cocoa...@charlessoft.com> 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com