(Is this really a topic for IBM-MAIN?)

FWIW, I would be surprised if most modern optimizing C compilers didn't
generate the same exact code, as well as:

   memcpy(dest, "LITERAL", sizeof("LITERAL")+1);

Kirk Wolf

On Mon, Sep 8, 2008 at 1:25 PM, John McKown <[EMAIL PROTECTED]> wrote:

> If I am copying literal text into a char array, which do you think is
> better:
>
> strcpy(dest,"LITERAL");
>
> OR
>
> memcpy(dest,"LITERAL",8);
>
> ?? I lean towards memcpy because the C run-time reference says that it is
> a builtin function and done in-line. Which I would guess would mean better
> performance. Why don't I just look at the generated code? Because I don't
> have a C compiler for z/OS. I'm writing my code on Linux using GCC.
>
> --
> Q: What do theoretical physicists drink beer from?
> A: An EIN stein.
>
> Maranatha!
> John McKown
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
> Search the archives at http://bama.ua.edu/archives/ibm-main.html
>
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to