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 09a9a8b was
843054c2,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
licencing: seventh groups of files
|
-
Property mode set to
100644
|
File size:
568 bytes
|
Rev | Line | |
---|
[a0d9f94] | 1 | extern "C" { |
---|
| 2 | int printf( const char *, ... ); |
---|
[c11e31c] | 3 | //#include <stdio.h> |
---|
[a0d9f94] | 4 | } |
---|
| 5 | |
---|
[42dcae7] | 6 | forall( type T | { int ?<?( T, T ); } ) |
---|
[3848e0e] | 7 | T min( const T t1, const T t2 ) { |
---|
[a0d9f94] | 8 | return t1 < t2 ? t1 : t2; |
---|
| 9 | } |
---|
| 10 | |
---|
| 11 | int main() { |
---|
[3848e0e] | 12 | char c; |
---|
[c11e31c] | 13 | // c = min( 'z', 'a' ); |
---|
| 14 | // printf( "minimum %d\n", c ); |
---|
[42dcae7] | 15 | int i; |
---|
| 16 | i = min( 4, 3 ); |
---|
| 17 | printf( "minimum %d\n", min( 4, 3 ) ); |
---|
[a0d9f94] | 18 | float f; |
---|
[42dcae7] | 19 | f = min( 4.0, 3.1 ); |
---|
| 20 | printf( "minimum %g\n", f ); |
---|
| 21 | double d; |
---|
| 22 | d = min( 4.0, 3.2 ); |
---|
| 23 | printf( "minimum %g\n", d ); |
---|
[a0d9f94] | 24 | } |
---|
[42dcae7] | 25 | |
---|
| 26 | // Local Variables: // |
---|
| 27 | // compile-command: "../../bin/cfa min.c" // |
---|
| 28 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.