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

Re: NSAssert and Unused Variable


  • Subject: Re: NSAssert and Unused Variable
  • From: Chris Suter <email@hidden>
  • Date: Thu, 3 Apr 2008 12:34:48 +1100


On 03/04/2008, at 11:30 AM, Jens Alfke wrote:

I seem to recall a pragma or macro that can be used to tell the compiler "I know this variable is unused, don't complain about it", though I don't remember the details...

Apple gcc only:

#pragma unused (var)

or

_Pragma("unused(var)")

The implementation of that pragma has some bugs in it that will cause gcc to crash or hang in certain circumstances that I really should report.

or you can do:

(void)var;

or  you can use the unused attribute e.g.:

void my_func (int a, int b __attribute__((__unused__)))

or

int var __attribute__((__unused__));

Unfortunately, there's no way that I know of to apply that attribute to Objective-C method parameters.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: Richard Somers <email@hidden>
References: 
 >NSAssert and Unused Variable (From: Richard Somers <email@hidden>)
 >Re: NSAssert and Unused Variable (From: Jens Alfke <email@hidden>)

  • Prev by Date: About the Primary Button problems in Cocoa Mouse Event Handling
  • Next by Date: DataSource for NSTableView with ButtonCell
  • Previous by thread: Re: NSAssert and Unused Variable
  • Next by thread: Re: NSAssert and Unused Variable
  • Index(es):
    • Date
    • Thread