source: src/examples/Members.c@ 882ad37

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 882ad37 was ca26509, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

relocate and delete example programs under Test directory to test/examples directories

  • Property mode set to 100644
File size: 968 bytes
RevLine 
[51b73452]1char ?=?( char*, char );
2int ?=?( int*, int );
3float ?=?( float*, float );
4forall( dtype DT ) DT * ?=?( DT**, DT* );
[55ba7339]5forall(otype T) lvalue T *?( T* );
[51b73452]6char *__builtin_memcpy();
7
8void a( char );
9void b( int );
10void c( int* );
11void d( float* );
12
[a65d92e]13struct a_struct {
14 int a;
15 char a;
16 float a;
[51b73452]17};
18
[a65d92e]19union b_struct {
20 int *a;
21 char *a;
22 float *a;
[51b73452]23};
24
[a65d92e]25void f() {
26 struct a_struct the_struct;
27 union b_struct the_struct;
[51b73452]28
[a65d92e]29 a( the_struct.a );
30 b( the_struct.a );
31 c( the_struct.a );
32 d( the_struct.a );
[51b73452]33}
34
[a65d92e]35struct c_struct {
36 int;
37 char;
38 float;
[51b73452]39};
40
[a65d92e]41union d_struct {
42 int*;
43 char*;
44 float*;
[51b73452]45};
46
[a65d92e]47void g() {
48 unsigned short x;
49 struct c_struct x;
50 union d_struct x;
[51b73452]51
[a65d92e]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 );
[51b73452]56}
57
58// make sure that forward declarations work
59
60struct forward;
61
62struct forward *q;
63
64struct forward { int y; };
65
[a65d92e]66void h() {
[51b73452]67 q->y;
68}
[a65d92e]69
70// Local Variables: //
71// tab-width: 4 //
72// End: //
Note: See TracBrowser for help on using the repository browser.