ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 91b216b4 was
51b7345,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
711 bytes
|
Line | |
---|
1 | #include <uC++.h> |
---|
2 | #include <uIOStream.h> |
---|
3 | |
---|
4 | typedef void (*fixup)( int &i, fixup r1, fixup r2 ); |
---|
5 | |
---|
6 | void f( int &i, fixup r1, fixup r2 ); |
---|
7 | void g( int &i, fixup r1, fixup r2 ); |
---|
8 | |
---|
9 | void h1( int &i, fixup r1, fixup r2 ) { |
---|
10 | i -= 1; |
---|
11 | uCout << "h1, i:" << i << endl; |
---|
12 | f( i, r1, r2 ); |
---|
13 | } |
---|
14 | void h2( int &i, fixup r1, fixup r2 ) { |
---|
15 | i -= 2; |
---|
16 | uCout << "h2, i:" << i << endl; |
---|
17 | g( i, r1, r2 ); |
---|
18 | } |
---|
19 | |
---|
20 | void f( int &i, fixup r1, fixup r2 ) { |
---|
21 | i -= 1; |
---|
22 | uCout << "f, i:" << i << endl; |
---|
23 | if ( i > 0 ) { |
---|
24 | if ( i % 2 != 0 ) r2(i, r1, r2); |
---|
25 | g( i, r1, r2 ); |
---|
26 | } |
---|
27 | } |
---|
28 | void g( int &i, fixup r1, fixup r2 ) { |
---|
29 | i -= 1; |
---|
30 | uCout << "g, i:" << i << endl; |
---|
31 | if ( i > 0 ) { |
---|
32 | f( i ); |
---|
33 | r1(i, r1, r2); |
---|
34 | } |
---|
35 | } |
---|
36 | void uMain::main() { |
---|
37 | int i = 20; |
---|
38 | f( i, h1, h2 ); |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.