source: translator/resume-3.cc @ 51b7345

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 51b7345 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

initial commit

  • Property mode set to 100644
File size: 801 bytes
Line 
1#include <uC++.h>
2#include <uIOStream.h>
3
4template< class fixup >
5void f( int &i, fixup r1, fixup r2 );
6template< class fixup >
7void g( int &i, fixup r1, fixup r2 );
8
9template< class fixup >
10void h1( int &i, fixup r1, fixup r2 ) {
11        i -= 1;
12        uCout << "h1, i:" << i << endl;
13        f( i, r1, r2 );
14}
15template< class fixup >
16void h2( int &i, fixup r1, fixup r2 ) {
17        i -= 2;
18        uCout << "h2, i:" << i << endl;
19        g( i, r1, r2 );
20}
21
22template< class fixup >
23void f( int &i, fixup r1, fixup r2 ) {
24        i -= 1;
25        uCout << "f, i:" << i << endl;
26        if ( i > 0 ) {
27                if ( i % 2 != 0 ) r2(i, r1, r2);
28                g( i, r1, r2 );
29        }
30}
31template< class fixup >
32void g( int &i, fixup r1, fixup r2 ) {
33        i -= 1;
34        uCout << "g, i:" << i << endl;
35        if ( i > 0 ) {
36                f( i );
37                r1(i, r1, r2);
38        }
39}
40void uMain::main() {
41        int i = 20;
42        f( i, h1, h2 );
43}
Note: See TracBrowser for help on using the repository browser.