OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [lcc/] [tst/] [fields.c] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 hellwig
struct foo {
2
        int a;
3
        char b;
4
        int x : 12, y : 4, : 0, : 4, z : 3;
5
        char c;
6
} x = { 1, 2, 3, 4, 5, 6 };
7
int i = 16;
8
struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9};
9
 
10
main()
11
{
12
        printf("x = %d %d %d %d %d %d\n", x.a, x.b, x.x, x.y, x.z, x.c);
13
        printf("y = %d %d %d\n", y.a, y.b, y.c);
14
        x.y = i;
15
        x.z = 070;
16
        printf("x = %d %d %d %d %d %d\n", x.a, x.b, x.x, x.y, x.z, x.c);
17
        y.a = 2;
18
        y.c = i;
19
        printf("y = %d %d %d\n", y.a, y.b, y.c);
20
        f2(&x);
21
        return 0;
22
}
23
 
24
f1(struct baz *p) {
25
        p->a = p->b = 0;
26
        if (p->b)
27
                printf("p->b != 0!\n");
28
        p->a = 0x3; p->b = 0xf;
29
        printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b);
30
}
31
f2(struct baz *p) {
32
        p->a = (i==0);
33
        p->b = (f1(p),0);
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.