source: translator/examples/specialize.c @ b1a6d6b

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 b1a6d6b was a0d9f94, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

add compiler flag to driver, update examples, fix unnamed bit fields

  • Property mode set to 100644
File size: 642 bytes
RevLine 
[a0d9f94]1// "./cfa specialize.c"
2// "./cfa -g simple.c"
3// "./cfa -CFA simple.c > simple_out.c"
4
5/// void f( const int * );
6///
7/// void m()
8/// {
9///   f( 0 );
10/// }
11
12/// forall( dtype T ) T* f( T* );
13/// void g( int* (*)(int*) );
14///
15/// int m() {
16///   g( f );
17/// }
18
19/// void f1( void (*q)( forall( dtype U ) U* (*p)( U* ) ) );
20/// void g1( int* (*)(int*) );
21///
22/// int m1() {
23///   f1( g1 );
24/// }
25
26extern "C" {
27  int printf( const char*, ... );
28}
29
30forall( type T ) T f( T t )
31{
32  printf( "in f; sizeof T is %d\n", sizeof( T ) );
33  return t;
34}
35
36void g( int (*p)(int) )
37{
38  printf( "g: f(7) returned %d\n", f(7) );
39}
40
41int main() {
42  g( f );
43}
Note: See TracBrowser for help on using the repository browser.