• 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: "unused" NSTimer variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "unused" NSTimer variable


  • Subject: Re: "unused" NSTimer variable
  • From: Nick Zitzmann <email@hidden>
  • Date: Fri, 26 Sep 2003 21:27:25 -0700

On Friday, September 26, 2003, at 03:24 PM, Chris Garaffa wrote:

I'm of the mindset that one should try to get rid of all warnings that show up when compiling a program, which is why I'm asking this. I use an NSTimer in my application, set up like this in an awakeFromNib:

NSTimer *statusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target:self selector:@selector(checkStatus) userInfo:nil repeats:YES];

When I compile, the only warning I get is "unused variable 'statusTimer'." However, my timer works just fine, no problems at all. Is there something I should/could do to get rid of the warning, or is it harmless?

In addition to what everyone else has told you, there is a way to disable those warnings for variables you know are unused without turning it off completely: #pragma unused(). For example:

NSString *unusedString = [NSString string];
#pragma unused(unusedString)

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://seiryu.home.comcast.net/

"I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." - Bjarne Stroustrup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >"unused" NSTimer variable (From: Chris Garaffa <email@hidden>)

  • Prev by Date: [ANN] CocoaTech source code
  • Next by Date: Re: API for icons in main menu-bar
  • Previous by thread: Re: "unused" NSTimer variable
  • Next by thread: [ANN] CocoaTech source code
  • Index(es):
    • Date
    • Thread