ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since e3bc51c was
bf71cfd,
checked in by Thierry Delisle <tdelisle@…>, 6 years ago
|
Moved up many directories in source
|
-
Property mode set to
100644
|
File size:
968 bytes
|
Line | |
---|
1 | char ?=?( char*, char ); |
---|
2 | int ?=?( int*, int ); |
---|
3 | float ?=?( float*, float ); |
---|
4 | forall( dtype DT ) DT * ?=?( DT**, DT* ); |
---|
5 | forall(otype T) lvalue T *?( T* ); |
---|
6 | char *__builtin_memcpy(); |
---|
7 | |
---|
8 | void a( char ); |
---|
9 | void b( int ); |
---|
10 | void c( int* ); |
---|
11 | void d( float* ); |
---|
12 | |
---|
13 | struct a_struct { |
---|
14 | int a; |
---|
15 | char a; |
---|
16 | float a; |
---|
17 | }; |
---|
18 | |
---|
19 | union b_struct { |
---|
20 | int *a; |
---|
21 | char *a; |
---|
22 | float *a; |
---|
23 | }; |
---|
24 | |
---|
25 | void f() { |
---|
26 | struct a_struct the_struct; |
---|
27 | union b_struct the_struct; |
---|
28 | |
---|
29 | a( the_struct.a ); |
---|
30 | b( the_struct.a ); |
---|
31 | c( the_struct.a ); |
---|
32 | d( the_struct.a ); |
---|
33 | } |
---|
34 | |
---|
35 | struct c_struct { |
---|
36 | int; |
---|
37 | char; |
---|
38 | float; |
---|
39 | }; |
---|
40 | |
---|
41 | union d_struct { |
---|
42 | int*; |
---|
43 | char*; |
---|
44 | float*; |
---|
45 | }; |
---|
46 | |
---|
47 | void g() { |
---|
48 | unsigned short x; |
---|
49 | struct c_struct x; |
---|
50 | union d_struct x; |
---|
51 | |
---|
52 | a( x ); // the 'a' and 'b' calls resolve to the ushort |
---|
53 | b( x ); // it's debatable whether this is good |
---|
54 | c( x ); |
---|
55 | d( x ); |
---|
56 | } |
---|
57 | |
---|
58 | // make sure that forward declarations work |
---|
59 | |
---|
60 | struct forward; |
---|
61 | |
---|
62 | struct forward *q; |
---|
63 | |
---|
64 | struct forward { int y; }; |
---|
65 | |
---|
66 | void h() { |
---|
67 | q->y; |
---|
68 | } |
---|
69 | |
---|
70 | // Local Variables: // |
---|
71 | // tab-width: 4 // |
---|
72 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.