fork(2) download
  1. #import <objc/objc.h>
  2. #import <objc/Object.h>
  3.  
  4. #import <Foundation/Foundation.h>
  5.  
  6. int main()
  7. {
  8.  
  9. NSArray *sorters = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"Height" ascending:YES]];
  10.  
  11. NSArray *persons = [NSArray arrayWithObjects:
  12. [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:1.0f], @"Height", @"Tom", @"Name", nil],
  13. [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:1.1f], @"Height", @"Dick", @"Name", nil],
  14. [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:0.9f], @"Height", @"Harry", @"Name", nil],
  15. nil];
  16. NSArray *sortedPersons = [persons sortedArrayUsingDescriptors:sorters];
  17. NSLog(@"Original: %@", persons);
  18. NSLog(@"Sorted: %@", sortedPersons);
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout #stderr 0.03s 10832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2014-04-22 04:23:54.807 prog[9784] autorelease called without pool for object (8e20ba8) of class GSInlineArray in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e21728) of class NSFloatNumber in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e5e7c8) of class GSDictionary in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e56b08) of class NSFloatNumber in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e5e578) of class GSDictionary in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e5e6e0) of class NSFloatNumber in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e5e5a8) of class GSDictionary in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e560e0) of class GSInlineArray in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.808 prog[9784] autorelease called without pool for object (8e55fd0) of class GSMutableArray in thread <NSThread: 0x8df6268>
2014-04-22 04:23:54.809 prog[9784] Original: ({Height = 1; Name = Tom; }, {Height = 1.1; Name = Dick; }, {Height = 0.9; Name = Harry; })
2014-04-22 04:23:54.809 prog[9784] Sorted: ({Height = 0.9; Name = Harry; }, {Height = 1; Name = Tom; }, {Height = 1.1; Name = Dick; })