Liste des Groupes | Revenir à c arch |
Tim Rentsch wrote:
>mitchalsup@aol.com (MitchAlsup1) writes:
>Memmove() is always appropriate unless you are doing something>
nefarious.
>
So:
# define memcpy memomve
Incidentally, if one wants to do this, it's advisable to write
>
#undef memcpy
>
before the #define of memcpy.
What really worries me is that I've been told (and shown in
godbolt) that memcpy() can be magic, i.e the ocmpiler is allowed
to make it NOP when I use it to move data between an integer and
float variable:
>
float invsqrt(float x)
{
...
int32_t ix = *(int32_t *) &x;
>
is deprecated, instead do something like this:
>
int32_t ix;
memcpy(&ix, &x, sizeof(ix));
>
and the compiler will see that x and ix can share the same
register.
>
I don't suppose memmove() can be dependent upon to do the same?
Les messages affichés proviennent d'usenet.