Skip to content

Instantly share code, notes, and snippets.

@kosugi
Created March 6, 2015 05:19
Show Gist options
  • Select an option

  • Save kosugi/d8ae592dda0aa3f0f8d9 to your computer and use it in GitHub Desktop.

Select an option

Save kosugi/d8ae592dda0aa3f0f8d9 to your computer and use it in GitHub Desktop.
// clang -Wall -x objective-c -std=c99 -fobjc-arc -framework Foundation -o a.out a.m
#import <objc/objc.h>
#import <objc/objc-runtime.h>
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
void foo(int a)
{
switch (a)
{
case 1: {
int b = a + 1;
NSLog(@"a: %d, b: %d", a, b);
break;
}
case 3: {
int b = a + 2;
NSLog(@"a: %d, b: %d", a, b);
break;
}
default: {
int b = a + 3;
NSLog(@"a: %d, b: %d", a, b);
break;
}
}
}
int main()
{
@autoreleasepool {
for (int i = 0; i < 10; ++i)
{
foo(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment