No, it is definitely different from memcpy:
https://en.cppreference.com/w/cpp/string/byte/memcpy
Both objects are reinterpreted as arrays of
unsigned char
.
char
, unsigned char
and std::byte
are exceptions from the type aliasing rules, I invite you to read the link I posted earlier.
In fact, memcpy
is the solution to “reinterpreting” an object of one type as a different type:
Where strict aliasing prohibits examining the same memory as values of two different types,
std::memcpy
may be used to convert the values.
Goto is a different issue, you can create valid code using goto, even though structured alternatives are usually preferred.
If you violate the aliasing rules, it's not valid code.