Re: Acceptable C optimizations? (Celsius Tech)
Fri, 29 Apr 1994 13:03:20 GMT

          From comp.compilers

Related articles
Acceptable C optimizations? (Ed Finch) (1994-04-27)
Re: Acceptable C optimizations? (1994-04-29)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Celsius Tech)
X-Organisation: Software Technology Park, Bangalore
Keywords: C, optimize
Organization: Compilers Central
References: 94-04-173
Date: Fri, 29 Apr 1994 13:03:20 GMT

>[ When is it OK to in-line "strcpy(x,"HelloWorld");" or
> memset(x,0,sizeof(x)); ?]

In both the cases you are assuming that the number of bytes to be copied
is constant. In fact the problem is a special case of inlining intrinsic

If it is known that the functions have predefined meaning, as understood
by the compiler, you can inline such functions. As a special case one can
do the optimizations described above.

Most of the comercial compilers I came across provide "# pragma intrinsic"
or option to allow user specify such optimization. The functions which are
inlined not only include string and memory functions but also some
mathematical functions. Most of the mathematical function implementations
are side-effect free and so when the floating point hardware is present
(which support such functions) inlining of such functions is helpful.

-- Vivek (

Post a followup to this message

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