source: translator/examples/min.c @ 42dcae7

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newstringwith_gc
Last change on this file since 42dcae7 was 42dcae7, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

re-inserted remove and reorder hoisted aggregate, fixed example programs

  • Property mode set to 100644
File size: 537 bytes
Line 
1extern "C" {
2    int printf( const char *, ... );
3}
4
5forall( type T | { int ?<?( T, T ); } )
6T min( T t1, T t2 ) {
7    return t1 < t2 ? t1 : t2;
8}
9
10int main() {
11//    char c;
12//    c = min( 'a', 'z' );
13//    printf( "minimum %d\n", c );
14    int i;
15    i = min( 4, 3 );
16    printf( "minimum %d\n", min( 4, 3 ) );
17    float f;
18    f = min( 4.0, 3.1 );
19    printf( "minimum %g\n", f );
20    double d;
21    d = min( 4.0, 3.2 );
22    printf( "minimum %g\n", d );
23}
24
25// Local Variables: //
26// compile-command: "../../bin/cfa min.c" //
27// End: //
Note: See TracBrowser for help on using the repository browser.