In this video , at about 6.39, the presenter seems to say that he new
always returns memory aligned to std::max_align_t
that, because he operator new
does not know anything about the type of allocated variable. That is, the compiler must choose the very lowercase alignment. But I can not find it in the Standard.
The host also says that this rule does not apply when new
used to allocate arrays char
or unsigned char
. In this case, alignment depends on the size. But it was not clear to me either.
source
share