aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test.c
blob: c107101c62098cd8893ed79941fb455c9a6b64d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* coment */

#if 1+1 < (-2*'a')
wawa
#elif 9<<1
#define wow 3
#else
boop
#endif

#define NULL ((void *)0)
int glob [ wow+wow];

struct foo {
    int x, y, z;
};

struct v2f { double x, y; };
struct big { int x[10]; };

struct v2f add(struct v2f a, struct v2f b, struct big B, struct { char c; } small, void *prt) {
    struct v2f r;
    r.y = a.y + b.y;
    return r;
}

struct pair {
    long x, y;
};

struct pair pair(long x, long y) {
    struct pair p;
    p.x = x;
    p.y = y;
    return p;
}

struct quad {
    long x, y, z, w;
};

struct quad quad(long x, long y, long z, long w) {
    struct quad q = {x,y,z,w};
    return q;
}

void silly(struct pair *p, struct quad *q)
{
    *p = pair(-1,2);
    *q = quad(1,2,3,4);
}

#if 0
int test2(struct big *b) {
    struct big s = *b;
    extern int h(int,float, struct big, float);
    s.x[5] += 2;
    return h(0, -.5f, s, 0);
}
#endif

struct f2 { float f,g; };
struct f2 f2test(struct f2 *r) {
   struct f2 q = {1,3,.f=2};
   *r = q;
    return *r;
}
#if 1
void fill(char *p, int c, unsigned long n)
{
    int t;
    if (n) do t = *p++ = c; while (--n);
}

void zero(void *p, unsigned long n) { fill(p,0,n); }

enum ball  {
    neg = -1,
    Zero,
    Two = 2,
    Three,
    One = Zero + 1,
    X = 2147483647,
    Y,
    Z,
    W = ~0ull //warn
};
enum ball x;

_Bool t(int t)
{
    return t;
}

struct f{
    union { int x,y;} ;
    char flex[];
};
#endif

int main() {
   char str[] = "abcdef!";
   int arr[] = {[4]=1,9001};
   str[1]&=~0x20;
   extern int printf(char *, ...);
   printf("%s %d,%d\n",str, arr[0],arr[5]);
   int bleh[500]={};
   return sizeof arr;
}
//