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 a65d92e was
86bd7c1f,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
licencing: eighth groups of files
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[86bd7c1f] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // specialize.c -- |
---|
| 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Wed May 27 17:56:53 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Wed May 27 18:32:26 2015 |
---|
| 13 | // Update Count : 2 |
---|
| 14 | // |
---|
[a0d9f94] | 15 | |
---|
| 16 | /// void f( const int * ); |
---|
| 17 | /// |
---|
| 18 | /// void m() |
---|
| 19 | /// { |
---|
| 20 | /// f( 0 ); |
---|
| 21 | /// } |
---|
| 22 | |
---|
| 23 | /// forall( dtype T ) T* f( T* ); |
---|
| 24 | /// void g( int* (*)(int*) ); |
---|
| 25 | /// |
---|
| 26 | /// int m() { |
---|
| 27 | /// g( f ); |
---|
| 28 | /// } |
---|
| 29 | |
---|
| 30 | /// void f1( void (*q)( forall( dtype U ) U* (*p)( U* ) ) ); |
---|
| 31 | /// void g1( int* (*)(int*) ); |
---|
| 32 | /// |
---|
| 33 | /// int m1() { |
---|
| 34 | /// f1( g1 ); |
---|
| 35 | /// } |
---|
| 36 | |
---|
| 37 | extern "C" { |
---|
[86bd7c1f] | 38 | int printf( const char*, ... ); |
---|
[a0d9f94] | 39 | } |
---|
| 40 | |
---|
| 41 | forall( type T ) T f( T t ) |
---|
| 42 | { |
---|
[86bd7c1f] | 43 | printf( "in f; sizeof T is %d\n", sizeof( T ) ); |
---|
| 44 | return t; |
---|
[a0d9f94] | 45 | } |
---|
| 46 | |
---|
| 47 | void g( int (*p)(int) ) |
---|
| 48 | { |
---|
[86bd7c1f] | 49 | printf( "g: f(7) returned %d\n", f(7) ); |
---|
[a0d9f94] | 50 | } |
---|
| 51 | |
---|
| 52 | int main() { |
---|
[86bd7c1f] | 53 | g( f ); |
---|
[a0d9f94] | 54 | } |
---|
[86bd7c1f] | 55 | |
---|
| 56 | // Local Variables: // |
---|
| 57 | // tab-width: 4 // |
---|
| 58 | // compile-command: "cfa specialize.c" // |
---|
| 59 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.