1 | #import <Foundation/Foundation.h> |
2 | |
3 | // This should be a big enough struct that it will force |
4 | // the struct return convention: |
5 | typedef struct BigStruct { |
6 | float a, b, c, d, e, f, g, h, i, j, k, l; |
7 | } BigStruct; |
8 | |
9 | |
10 | @interface Simple : NSObject |
11 | { |
12 | int _value; |
13 | } |
14 | - (int) value; |
15 | - (void) setValue: (int) newValue; |
16 | - (BigStruct) getBigStruct; |
17 | @end |
18 | |
19 | @implementation Simple |
20 | - (int) value |
21 | { |
22 | return _value; |
23 | } |
24 | |
25 | - (void) setValue: (int) newValue |
26 | { |
27 | _value = newValue; |
28 | } |
29 | |
30 | - (BigStruct) getBigStruct |
31 | { |
32 | BigStruct big_struct = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, |
33 | 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}; |
34 | return big_struct; |
35 | } |
36 | @end |
37 | |
38 | int main () |
39 | { |
40 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
41 | Simple *my_simple = [[Simple alloc] init]; |
42 | my_simple.value = 20; |
43 | // Set a breakpoint here. |
44 | NSLog (@"Object has value: %d." , my_simple.value); |
45 | [pool drain]; |
46 | return 0; |
47 | } |
48 | |