Guest User

Untitled

a guest
Oct 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. //
  2. // main.m
  3. // Literals
  4. //
  5. // Created by Bruno Gama on 14/06/12.
  6. // Copyright (c) 2012 Bruno Gama. All rights reserved.
  7. //
  8.  
  9. #import <Foundation/Foundation.h>
  10.  
  11.  
  12.  
  13. int main(int argc, const char * argv[])
  14. {
  15.  
  16. @autoreleasepool {
  17.  
  18. __block id num = @ 5.1,
  19. arr = @ [@"a", @"b", @"c", @1, @2., @.3],
  20. dic = @{ @"hi" : num, @"sup" : arr };
  21.  
  22. #define _c(theString) \
  23. [[(theString) class] description]
  24. // Console output:
  25. // 2012-06-14 21:30:35.296 Literals[8203:403] key=hi (__NSCFConstantString), obj=5.1 (__NSCFNumber)
  26. // 2012-06-14 21:30:35.298 Literals[8203:403] key=sup (__NSCFConstantString), obj=(
  27. // a,
  28. // b,
  29. // c,
  30. // 1,
  31. // 2,
  32. // "0.3"
  33. // ) (__NSArrayI)
  34. //
  35. [dic enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
  36. NSLog(@"key=%@ (%@), obj=%@ (%@)", key, _c(key), obj, _c(obj));
  37. }];
  38.  
  39. }
  40. return 0;
  41. }
Add Comment
Please, Sign In to add comment