• 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
NSAssert and Unused Variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAssert and Unused Variable


  • Subject: NSAssert and Unused Variable
  • From: Richard Somers <email@hidden>
  • Date: Wed, 2 Apr 2008 18:03:11 -0600

I use a function which returns an error code. The error variable is used in a NSAssert.

    int error = foo();
    NSAssert(error == 0, @"We have an assertion failure!");

The NSAssert complies out in the release configuration by using the preprocessor macro NS_BLOCK_ASSERTIONS. This results in a warning: unused variable "error".

Do most programmers turn off the unused variable warnings or do something else to get this to work.

Regards, Richard

_______________________________________________

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:
    • Re: NSAssert and Unused Variable
      • From: Jens Alfke <email@hidden>
    • Re: NSAssert and Unused Variable
      • From: John Newlin <email@hidden>
  • Prev by Date: Re: Name of NSTableView
  • Next by Date: Re: NSAssert and Unused Variable
  • Previous by thread: unhandled property type encoding
  • Next by thread: Re: NSAssert and Unused Variable
  • Index(es):
    • Date
    • Thread