- edited description
Requesting note about __unused variables
Can't recall seeing this, can't check now, but just in case...
I have debug code, which defines a local variable only used in debug code. Thus when building a release, there's build break due unused variable. The quick fix has been to define the variable in question with __unused prefix.
Would be nice to have a reminder to fix those later, after release has been delivered and panic phase is over. Sample code:
// Using item A called this method 1505 times
// UI displays progress in full percents i.e. max 101 different values (0-100)
static __unused NSInteger count = 0;
DLog(@"%@", @(++count));
Comments (5)
-
repo owner -
repo owner Thanks for the feature request. Warnings about
__unused
variables that are actually used has been requested before, and is on the backlog. -
reporter In this specific case release build does not use the "count" variable, since DLOG definition is
#ifdef DEBUG # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #else # define DLog(...) #endif
-
repo owner A rule that warns about
__unused
variables that are actually used should also help you catch these cases, if you run Faux Pas on the debug build. -
repo owner - changed status to closed
Added in v1.3
- Log in to comment