Guest User

Untitled

a guest
Jun 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main (int argc, const char * argv[]) {
  4. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  5.  
  6. int *x = malloc(sizeof(int));
  7. void *foo = x;
  8.  
  9. NSMutableData *d = [NSMutableData dataWithBytesNoCopy:foo length:sizeof(int) freeWhenDone:NO];
  10.  
  11. NSLog(@"a: %p", [d mutableBytes]);
  12. NSLog(@"b: %p", foo);
  13.  
  14. assert([d mutableBytes] == foo);
  15.  
  16. free(x);
  17.  
  18. [pool drain];
  19. return 0;
  20. }
Add Comment
Please, Sign In to add comment