Acceptable C optimizations?

Ed Finch <>
Wed, 27 Apr 1994 04:11:57 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: Ed Finch <>
Keywords: C, optimize, question, comment
Organization: Compilers Central
Date: Wed, 27 Apr 1994 04:11:57 GMT

I have a question on possible optimizations:

When, if at all, is it acceptable for a compiler to perform the following

In C, strcpy() can be used as "strcpy(x,"HelloWorld");". Rather than emit
a call to strcpy, why not simply emit the machine instructions directly?
I.e., something like a 'move bytes' instruction - move dest to src
for 11 bytes.

Similarly, calls like memset(x,0,sizeof(x)); could also be handled.

Ed Finch
[My reading of ANSI says that if a program includes the header that defines
the functions, <string.h> in these cases, the names are reserved and the
compiler can generate any old code it wants that gets the correct effect.
In fact, inlining these functions is quite common because it gives you
great Dhrystone numbers. -John]

Post a followup to this message

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