source: translator/examples/min.c@ 643a2e1

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

underscore changes, ptrdiff_t changes, formating, _Bool prelude

  • Property mode set to 100644
File size: 543 bytes
Line 
1extern "C" {
2 int printf( const char *, ... );
3}
4
5forall( type T | { int ?<?( T, T ); } )
6T min( const T t1, const 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.