|Acceptable C optimizations? firstname.lastname@example.org (Ed Finch) (1994-04-27)|
|Re: Acceptable C optimizations? email@example.com (1994-04-29)|
|From:||firstname.lastname@example.org (Celsius Tech)|
|X-Organisation:||Software Technology Park, Bangalore|
|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 (email@example.com)
Return to the
Search the comp.compilers archives again.