Skip to content

Instantly share code, notes, and snippets.

@markd2
Created May 23, 2013 13:44
Show Gist options
  • Save markd2/5636175 to your computer and use it in GitHub Desktop.
Save markd2/5636175 to your computer and use it in GitHub Desktop.
Implementation of doSome:for:, ripe for disassembly. Look at the disassembly of main() for the calls to objc_msgSend.
#import <Foundation/Foundation.h>
// clang -g -Wall -framework Foundation -o someObject someObject.m
@interface SomeObject : NSObject
- (void) doSome: (id) stuff for: (id) reasons;
@end // SomeObject
@implementation SomeObject
- (void) doSome: (id) stuff for: (id) reasons {
NSLog (@"Did some %@ for %@", stuff, reasons);
} // doSome
@end // SomeObject
int main (void) {
@autoreleasepool {
SomeObject *obj = [[SomeObject alloc] init];
[obj doSome: @"stuff" for: @"reasons"];
}
return 0;
} // main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment