N
Noob
Hello,
Consider
int i = 123;
int j = 456;
memcpy(&i, &j, 0);
Is the call to memcpy with len==0 well-defined, and equivalent
to a NOP, leaving the entire state machine unchanged?
(i and j unchanged, but everything else too)
I believe memcpy(foo, bar, 0) is indeed equivalent to a NOP.
Please correct me if I'm wrong.
My C89 draft only states
4.11.2.1 The memcpy function
Synopsis
#include <string.h>
void *memcpy(void *s1, const void *s2, size_t n);
Description
The memcpy function copies n characters from the object pointed to
by s2 into the object pointed to by s1 . If copying takes place
between objects that overlap, the behavior is undefined.
Returns
The memcpy function returns the value of s1 .
Regards.
Consider
int i = 123;
int j = 456;
memcpy(&i, &j, 0);
Is the call to memcpy with len==0 well-defined, and equivalent
to a NOP, leaving the entire state machine unchanged?
(i and j unchanged, but everything else too)
I believe memcpy(foo, bar, 0) is indeed equivalent to a NOP.
Please correct me if I'm wrong.
My C89 draft only states
4.11.2.1 The memcpy function
Synopsis
#include <string.h>
void *memcpy(void *s1, const void *s2, size_t n);
Description
The memcpy function copies n characters from the object pointed to
by s2 into the object pointed to by s1 . If copying takes place
between objects that overlap, the behavior is undefined.
Returns
The memcpy function returns the value of s1 .
Regards.