[PATCH] D22725: [clang-tidy] Add check 'misc-replace-memcpy'

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 15:17:42 PDT 2016


Prazek added a comment.

In https://reviews.llvm.org/D22725#495329, @etienneb wrote:

> In https://reviews.llvm.org/D22725#494167, @Prazek wrote:
>
> > hmm It seems that I mislead you, I suck at C api - memmove source and destination can overlap, but std::move can't. So I guess you have to remove the memmove support. Sorry.
>
>
> On windows (MSVC CRT), both function are the same : memmove.


It is possible that the call to move with some trivialy copyable object would end up calling memmove, even if the call is wrong.

quote from http://en.cppreference.com/w/cpp/algorithm/move

> d_first	-	the beginning of the destination range. If d_first is within [first, last), std::move_backward must be used instead of std::move.


But this is only the special ability of memmove, so we should not introduce stl-implementation dependent bugs


https://reviews.llvm.org/D22725





More information about the cfe-commits mailing list