Created
February 4, 2015 10:34
-
-
Save alikaragoz/c627c884dc2c9f549396 to your computer and use it in GitHub Desktop.
Clever assertions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define AssertOr(condition, action) { \ | |
BOOL evaluatedCondition = !!(condition); \ | |
if (!evaluatedCondition) { \ | |
NSAssert(evaluatedCondition, @#condition); \ | |
action \ | |
} \ | |
} \ | |
#define AssertOrReturnNil(condition) AssertOr(condition, return nil;) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment