sizeof("LITERAL") is a compile time constant of 8.  The +1 introduces
undefined behavior.

-----Original Message-----
From: Kirk Wolf [mailto:snip] 
Sent: Monday, September 08, 2008 12:05 PM
To: [email protected]
Subject: Re: question for C experts - strcpy vs memcpy

(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);

----------------------------------------------------------------------
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