• 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: Refactoring a #define definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refactoring a #define definition


  • Subject: Re: Refactoring a #define definition
  • From: Dave <email@hidden>
  • Date: Thu, 25 Jun 2015 11:04:35 +0100

> On 24 Jun 2015, at 18:52, Carl Hoefs <email@hidden> wrote:
>>
>> Or better still, disable the “Refactor Menu Item” if something is selected that it doesn’t handle, seems pointless (and potentially dangerous) to me to allow the user to select something just to tell them (in a round-about manner) that it can’t handle what they have selected.
>
> The real question is why is it impossible for Xcode to refactor a #define?
> -Carl

It depends on what you mean by “refactor” it could globally replace it (behind the scenes), but an #define is handled differently from (say) a property or a method name. For these types of symbol it actually looks up the symbols in the compiler data structures rather than blindly looking at the source code - which is why it doesn’t always work.

For instance if you had two classes that both define a property called “fred”:

@interface ClassA

@property (nonatomic,retain)  NSString* 	fred;

@end


@interface ClassB

@property (nonatomic,retain)  NSString* 	fred;

@end

If you refactor “fred” in ClassA, it doesn’t (or shouldn’t) change ClassB whereas a Global Replace would change it everywhere.

Cheers
Dave



 _______________________________________________
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: 
 >Refactoring a #define definition (From: Carl Hoefs <email@hidden>)
 >Re: Refactoring a #define definition (From: Roland King <email@hidden>)
 >Re: Refactoring a #define definition (From: Carl Hoefs <email@hidden>)
 >Re: Refactoring a #define definition (From: Alex Zavatone <email@hidden>)
 >Re: Refactoring a #define definition (From: Dave <email@hidden>)
 >Re: Refactoring a #define definition (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Re: Refactoring a #define definition
  • Next by Date: SCM History->Show x modified files
  • Previous by thread: Re: Refactoring a #define definition
  • Next by thread: NSStatusItem popUpStatusItemMenu shows menu over main menubar instead of below it
  • Index(es):
    • Date
    • Thread