Transformations of pointer parameters in C

krinke@infbssts.cs.tu-bs.de (Jens Krinke)
24 May 1996 15:45:30 -0400

          From comp.compilers

Related articles
Transformations of pointer parameters in C krinke@infbssts.cs.tu-bs.de (1996-05-24)
Re: Transformations of pointer parameters in C derek@knosof.co.uk (Derek M Jones) (1996-05-26)
| List of all articles for this month |

From: krinke@infbssts.cs.tu-bs.de (Jens Krinke)
Newsgroups: comp.compilers,comp.lang.c
Date: 24 May 1996 15:45:30 -0400
Organization: TU Braunschweig, FRG
Keywords: C, optimize

Hi,


I want to do a transformation of C-programs to eliminate some
pointers. As C has no reference parameters, they are often emulated
like this:


void add(int a, int b, int* c){
    *c = a + b;
}


main(){
    int z;
    add(1, 2, &z);
    ...
}


In my abstract syntax tree of that program I want to transform it into
an extended C with reference parameters. The example would look like
the following, which has a reference paramater notation similar to
C++:


void add(int a, int b, int& c){
    c = a + b;
}


main(){
    int z;
    add(1, 2, z);
    ...
}


Has anybody done something like that before? (Of course, you can think
of more complicated examples, where the actual argument is a
pointer...)
Any hint would be appreciated.


Thanks,
Jens
--
______________________________________________________________________
  Jens Krinke krinke@ips.cs.tu-bs.de
  +49 531 391 7583 http://www.cs.tu-bs.de/~krinke


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.