diff options
Diffstat (limited to 'misc/examples/box2.c')
| -rw-r--r-- | misc/examples/box2.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/misc/examples/box2.c b/misc/examples/box2.c index cba255d2..eaab1c47 100644 --- a/misc/examples/box2.c +++ b/misc/examples/box2.c @@ -13,27 +13,25 @@ typedef struct { Point bottom_right; } Rectangle; -#define i_val Point -#define i_no_cmp +#define i_key Point #include <stc/cbox.h> // cbox_Point -#define i_val Rectangle -#define i_no_cmp +#define i_key Rectangle #include <stc/cbox.h> // cbox_Rectangle // Box in box: -#define i_valboxed cbox_Point // NB: use i_valboxed when value is a cbox or carc! #define i_type BoxBoxPoint +#define i_keyboxed cbox_Point // NB: use i_keyboxed when value is a cbox or carc! #define i_no_cmp #include <stc/cbox.h> // BoxBoxPoint Point origin(void) { - return (Point){ .x=1.0, .y=2.0 }; + return c_LITERAL(Point){ .x=1.0, .y=2.0 }; } cbox_Point boxed_origin(void) { // Allocate this point on the heap, and return a pointer to it - return cbox_Point_make((Point){ .x=1.0, .y=2.0 }); + return cbox_Point_make(c_LITERAL(Point){ .x=1.0, .y=2.0 }); } @@ -46,7 +44,7 @@ int main(void) { }; // Heap allocated rectangle - cbox_Rectangle boxed_rectangle = cbox_Rectangle_make((Rectangle){ + cbox_Rectangle boxed_rectangle = cbox_Rectangle_make(c_LITERAL(Rectangle){ .top_left = origin(), .bottom_right = { .x=3.0, .y=-4.0 } }); |
