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 17cd4eb was
17cd4eb,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string
|
-
Property mode set to
100644
|
File size:
412 bytes
|
Line | |
---|
1 | extern "C" { |
---|
2 | int printf( const char *, ... ); |
---|
3 | } |
---|
4 | |
---|
5 | forall( type T ) |
---|
6 | T swap( T *left, T *right ) { |
---|
7 | T temp; |
---|
8 | temp = *left; |
---|
9 | *left = *right; |
---|
10 | *right = temp; |
---|
11 | return *right; |
---|
12 | } |
---|
13 | |
---|
14 | int main() { |
---|
15 | int x = 1, y = 2; |
---|
16 | printf( "%d %d\n", x, y ); |
---|
17 | int w; |
---|
18 | w = swap( &x, &y ); |
---|
19 | printf( "%d %d %d\n", w, x, y ); |
---|
20 | } |
---|
21 | |
---|
22 | // Local Variables: // |
---|
23 | // compile-command: "../../bin/cfa swap.c" // |
---|
24 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.