source: src/examples/specialize.c@ 2bae7307

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since 2bae7307 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 642 bytes
Line 
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.