Changeset 0b2961f for src/Tests/SynTree/Forall.c
- Timestamp:
- Jun 9, 2015, 3:19:04 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 8a95629
- Parents:
- 81419b5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tests/SynTree/Forall.c
r81419b5 r0b2961f 9 9 10 10 context sumable( type T ) { 11 12 13 14 11 const T 0; 12 T ?+?(T, T); 13 T ?++(T); 14 [T] ?+=?(T,T); 15 15 }; 16 16 … … 32 32 int i; 33 33 for ( i = 0; i < n; i += 1 ) 34 34 total = total + a[i]; 35 35 return total; 36 36 } … … 41 41 } 42 42 43 forall( type T | { const T 0; int ?!=?(T, T); int ?<?(T, T); } ) 44 T min( T t1, T t2 ) { 45 return t1 < t2 ? t1 : t2; 46 } 47 43 48 int main() { 44 45 49 int x = 1, y = 2, a[10]; 50 float f; 46 51 47 48 twice( x, y);49 50 52 swap( x, y ); 53 twice( x ); 54 f = min( 4.0, 3.0 ); 55 sum( 10, a ); 51 56 } 52 57
Note: See TracChangeset
for help on using the changeset viewer.