Implementation of memmove Here is my implementation of memmove; where can I improve?

void* memmove(void* dest, const void* src, std::size_t count)
{
    char *dest_ = static_cast&lt;char*&gt;(dest), *src_ = (char*)(src);
    if ((char*)src + count &gt; dest &amp;&amp; src &lt; dest) //
    {
        dest_ += (src_ += count - 1, count - 1);
        while (count--) *dest_-- = *src_--;
    }
    else while (count--) *dest_++ = *src_++;
    return dest;
}
Missing header: #include &lt;cstddef&gt; is required for std::size_t (other headers also provide it).
There's no need for src_ to cast away the constness of *src:
char *dest_ = static_cast&lt;char*&gt;(dest);
char const *src_ = static_cast&lt;char const*&gt;(src);

Personally, I'd just go for d and s rather than the ugly trailing underscores, but that's very much a matter of taste.
Arithmetic and comparison between pointers to different objects is unspecified behaviour, and I don't see a way to avoid it in the test.  Thankfully, in the case where src and dest are in different objects, it doesn't matter which branch you take
There's no need to test for src + count &gt; dest as well as src &lt; dest; we can quite happily use the &quot;reverse&quot; copy for any lower-to-higher copy, as long as we don't subtract from count==0 in that branch.
In the &quot;reverse&quot; branch, it's disingenuous to hide the assignment to src_ inside the assignment to dest_.  Much clearer to write as:
    src_ += count - 1;
    dest_ += count - 1;

We can avoid that -1 if we pre-decrement rather than post-decrement (it's safe to point to one past the end).
Style: Use braces on both sides of else, or neither; avoid if () {} else ;.

My version
#include &lt;cstddef&gt;

void *memmove(void *dest, const void *src, std::size_t count)
{
    auto d = static_cast&lt;char*&gt;(dest);
    auto s = static_cast&lt;char const*&gt;(src);

    // If s and d are in distinct objects, the comparison is
    // unspecified behaviour, but either branch will work.
    if (s &lt; d) {
        s += count;
        d += count;
        while (count--)
            *--d = *--s;
    } else {
        while (count--)
            *d++ = *s++;
    }

    return dest;
}


Performance
Copying a single char at a time is going to be sloowww.  Real implementations take advantage of processors' native transfer size, DMA hardware, and specialized instructions where available.  That's why it's a standard library function rather than user-supplied.