blob: da73f71e6f8ba7fc489be9909ad7df416bb3338b (
plain)
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
|
#include <stdio.h>
typedef int MyInt;
struct FunStruct
{
int i;
int j;
};
typedef struct FunStruct MyFunStruct;
typedef MyFunStruct *MoreFunThanEver;
int main()
{
MyInt a = 1;
printf("%d\n", a);
MyFunStruct b;
b.i = 12;
b.j = 34;
printf("%d,%d\n", b.i, b.j);
MoreFunThanEver c = &b;
printf("%d,%d\n", c->i, c->j);
return 0;
}
/* "If the specification of an array type includes any type qualifiers,
the element type is so-qualified, not the array type." */
typedef int A[3];
extern A const ca;
extern const A ca;
extern const int ca[3];
typedef A B[1][2];
extern B const cb;
extern const B cb;
extern const int cb[1][2][3];
extern B b;
extern int b[1][2][3];
/* Funny but valid function declaration. */
typedef int functype (int);
extern functype func;
int func(int i)
{
return i + 1;
}
/* Even funnier function decl and definition using typeof. */
int set_anon_super(void);
int set_anon_super(void)
{
return 42;
}
typedef int sas_type (void);
extern typeof(set_anon_super) set_anon_super;
extern sas_type set_anon_super;
/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
|