source: translator/examples/min.c @ 1db2c5be

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 1db2c5be was a0d9f94, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

add compiler flag to driver, update examples, fix unnamed bit fields

  • Property mode set to 100644
File size: 353 bytes
Line 
1// "./cfa min.c"
2// "./cfa -CFA min.c > min_out.c"
3// "gcc32 -g min_out.c LibCfa/libcfa.a"
4
5extern "C" {
6    int printf( const char *, ... );
7}
8
9forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } )
10T min( T t1, T t2 ) {
11    return t1 < t2 ? t1 : t2;
12}
13
14int main() {
15    float f;
16    f = min( 4.0, 3.0 );
17    printf( "result is %f\n", f );
18}
Note: See TracBrowser for help on using the repository browser.