Re: NSAssert and Unused Variable
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