C Pointer Arithmetic -> Array Reference

Etienne GAGNON <gagnon@bluebeard.cs.mcgill.ca>
Sat, 17 Sep 1994 22:40:04 GMT

          From comp.compilers

Related articles
C Pointer Arithmetic -> Array Reference gagnon@bluebeard.cs.mcgill.ca (Etienne GAGNON) (1994-09-17)
Re: C Pointer Arithmetic -> Array Reference schooler@apollo.hp.com (1994-09-19)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Etienne GAGNON <gagnon@bluebeard.cs.mcgill.ca>
Keywords: C, optimize, question
Organization: Compilers Central
Date: Sat, 17 Sep 1994 22:40:04 GMT

Hi,


Does anyone know about books, articles or papers written on
converting pointer arithmetic to array reference automatically?


e.g.: main() ===>> main()
                        { {
                            int a[100]; int a[100];
                            int *p; int *p;
                            int i; int i;


                            p = a; p = a;
                            for( i=0; i<100; i++ ) for( i=0; i<100; i++ )
                                { {
                                    *p = 0; ===>> /* pointer arithmetic p++ removed */
                                    p++; ===>> a[i] = 0; /* or p[i]=0 */
                                } }
                        } }


Thank you for help.


    - Etienne


e-mail: gagnon@acaps.cs.mcgill.ca
--


Post a followup to this message

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