Question Details

No question body available.

Tags

c++ language-lawyer lifetime memcpy memmove

Answers (1)

January 6, 2026 Score: 6 Rep: 407 Quality: Medium Completeness: 80%

No, cppreference is not overzealous. The mention of "implicitly creates objects" is actually the specific mechanism that legalizes the use of std::memmove on raw memory (like that from mmap or malloc).

Explanation: Prior to C++20, writing to raw storage without using placement-new was technically Undefined Behavior because no "object" existed there. C++20 (via paper P0593R6) retroactively fixed this by introducing Implicit Object Creation.

The text you highlighted is a permission, not a restriction. It tells the abstract machine that calling std::memmove on raw bytes automatically starts the lifetime of an object in the destination, making the operation valid C++.

Standard References: According to [[cstring.syn] paragraph 3]:

"The functions memcpy and memmove are signal-safe. Both functions implicitly create objects in the destination region of storage immediately prior to copying the sequence of characters to the destination."

And [[intro.object] paragraph 13] confirms that operations like memmove are valid for starting the lifetime of implicit-lifetime types (which includes arrays of bytes and PODs).

Regarding mmap: Memory returned by C-APIs like mmap provides valid storage. Because std::memmove implicitly creates objects, you can legally copy data into that storage without explicit placement-new, and the resulting memory will contain valid C++ objects.