Skip to content

Instantly share code, notes, and snippets.

@sodastsai
Last active July 23, 2020 09:37
Show Gist options
  • Save sodastsai/7b6cdb9815621b46f44747b9de229a63 to your computer and use it in GitHub Desktop.
Save sodastsai/7b6cdb9815621b46f44747b9de229a63 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
// clang -o main -framework Foundation main.m
int main(int argc, const char*argv[]) {
@autoreleasepool {
NSLog(@"%@", (@42).class); // __NSCFNumber
NSLog(@"%@", (@YES).class); // __NSCFBoolean
NSLog(@"%@", @"Hello".class); // __NSCFConstantString
NSLog(@"%@", [NSString stringWithFormat:@"%d", 42].class); // NSTaggedPointerString
NSLog(@"%@", [NSData dataWithBytes:"ABC" length:3].class); // _NSInlineData
NSLog(@"%@", [@"ABC" dataUsingEncoding:NSUTF8StringEncoding].class); // NSConcreteMutableData
NSLog(@"%@", @[@42].class); // __NSSingleObjectArrayI
NSLog(@"%@", @[@42, @43].class); // __NSArrayI
NSLog(@"%@", [NSArray array].class); // __NSArray0
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment