Last active
August 29, 2015 14:11
-
-
Save toshi0383/c16cbb6d1d6d1387ccae to your computer and use it in GitHub Desktop.
NSArray にdefineマクロの数値を突っ込むと。。 ref: http://qiita.com/toshi0383/items/c15581f18c49714714c5
This file contains 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 ZERO 0 | |
#define ONE 1 | |
#define A "a" | |
NSLog(@"ONE = %d", ONE); | |
NSArray *array = [NSArray arrayWithObjects:ZERO, ONE, A, nil]; | |
NSLog(@"array.count = %d", array.count); | |
NSLog(@"array = %@", array); | |
array = [NSArray arrayWithObjects:@"0", @"1", nil]; | |
NSLog(@"array.count = %d", array.count); | |
NSLog(@"array = %@", array); | |
for (int i = 0; i < array.count; i++) { | |
id a = array[i]; | |
NSLog(@"class of a is: %@", [a class]); | |
} |
This file contains 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
2014-12-10 18:22:43.297 TEST[76897:3889959] ONE = 1 | |
2014-12-10 18:22:43.297 TEST[76897:3889959] array.count = 0 | |
2014-12-10 18:22:43.298 TEST[76897:3889959] array = ( | |
) | |
2014-12-10 18:22:43.298 TEST[76897:3889959] array.count = 2 | |
2014-12-10 18:22:43.298 TEST[76897:3889959] array = ( | |
0, | |
1 | |
) | |
2014-12-10 18:22:43.298 TEST[76897:3889959] class of a is: __NSCFConstantString | |
2014-12-10 18:22:43.298 TEST[76897:3889959] class of a is: __NSCFConstantString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment