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