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 02e9ae2 was
0b8cd722,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
fix uninitialized value, fix memory reads after frees
|
-
Property mode set to
100644
|
File size:
375 bytes
|
Line | |
---|
1 | extern "C" { |
---|
2 | int printf( const char *, ... ); |
---|
3 | } |
---|
4 | |
---|
5 | forall( type T ) |
---|
6 | void swap( T *left, T *right ) { |
---|
7 | T temp; |
---|
8 | temp = *left; |
---|
9 | *left = *right; |
---|
10 | *right = temp; |
---|
11 | } |
---|
12 | |
---|
13 | int main() { |
---|
14 | int x = 1, y = 2; |
---|
15 | printf( "%d %d\n", x, y ); |
---|
16 | swap( &x, &y ); |
---|
17 | printf( "%d %d\n", x, y ); |
---|
18 | } |
---|
19 | |
---|
20 | // Local Variables: // |
---|
21 | // compile-command: "../../bin/cfa swap.c" // |
---|
22 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.