Re: Possible ANSI C Optimisation Done in Practice?

"Robert Sherry" <rsherry8@home.com>
15 Dec 2001 00:39:43 -0500

          From comp.compilers

Related articles
Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-11)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (Ralph Corderoy) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? rsherry8@home.com (Robert Sherry) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? rbates@southwind.net (Rodney M. Bates) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-19)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? RLWatkins@CompuServe.Com (R. L. Watkins) (2001-12-20)
[11 later articles]
| List of all articles for this month |

From: "Robert Sherry" <rsherry8@home.com>
Newsgroups: comp.compilers
Date: 15 Dec 2001 00:39:43 -0500
Organization: Excite@Home - The Leader in Broadband http://home.com/faster
References: 01-12-050
Keywords: C, optimize
Posted-Date: 15 Dec 2001 00:39:43 EST

        For the case given, an optimizing compiler could perform the
optimization of calling the strlen function only once. This optimization
could be in done, with the following difficulties:


        1) The compiler needs to know the strlen is a standard function and that
its return value is based sole on its argument.
        2) The compiler also has to realize that the pointer s does not change.
        3) The compiler has to recognize that the contents of the string pointed
to by s does not change. To due this, it must recognize that t points to tmp
and s does not point to s. This is not so easy to implement.




                                                                                                Robert Sherry


"Ralph Corderoy" <ralph@inputplus.demon.co.uk> wrote in message
> [ can a C compiler optimize strlen(s) out of a loop? ]


Post a followup to this message

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