Created
September 19, 2017 15:08
-
-
Save mikeash/8fa29b20b94e74c5fba6bf70126707b6 to your computer and use it in GitHub Desktop.
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
/*usr/bin/true | |
clang -framework Cocoa -g compile-time-class.m && ./a.out | |
exit;*/ | |
#import <Foundation/Foundation.h> | |
#define COMPILE_TIME_CLASS(name) ^{ \ | |
extern void *OBJC_CLASS_$_ ## name; \ | |
return (Class)&OBJC_CLASS_$_ ## name; \ | |
}() | |
int main(int argc, char **argv) { | |
NSLog(@"%@", COMPILE_TIME_CLASS(NSString)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment