Solving C++ 'target of assignment not really an lvalue' errors

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2012-10-30T16:42:01Z Indexed on 2012/10/30 17:01 UTC
Read the original article Hit count: 177

Filed under:
|
|

Given this code:

void FrMemCopy(void *to, const void *from, size_t sz)
{
    size_t sz8 = sz >> 3;
    size_t sz1 = sz - (sz8 << 3);

    while (sz8-- != 0) {
        *((double *)to)++ = *((double *)from)++;
    }

    while (sz1-- != 0) {
        *((char *)to)++ = *((char *)from)++;
    }
}

I am receiving target of assignment not really an lvalue warnings on the 2 lines inside the while loops.

Can anyone break down those lines?

a cast then an increment?

What is a simplier way to write that?

What does the error mean?

© Stack Overflow or respective owner

Related posts about c++

Related posts about compiler