aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/external/metalang99/examples/overload.c
blob: 8b5d6fdc0c7a4819efc36c072b58539b8e0a389b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <metalang99.h>

typedef struct {
    double width, height;
} Rect;

#define Rect_new(...) ML99_OVERLOAD(Rect_new_, __VA_ARGS__)
#define Rect_new_1(x)                                                                              \
    { x, x }
#define Rect_new_2(x, y)                                                                           \
    { x, y }

static Rect _7x8 = Rect_new(7, 8), _10x10 = Rect_new(10);

int main(void) {}