I can't understand the quote (specifically, the bold part):
A prvalue of type “pointer to cv1 void” can be converted to a prvalue of type “pointer to cv2 T”, where T is an object type and cv2 is the same cv-qualification as, or greater cv-qualification than, cv1. If the original pointer value represents the address A of a byte in memory and A does not satisfy the alignment requirement of T, then the resulting pointer value is unspecified.
int i = 0;
void *vp = &i;
auto *res = static_cast<double*>(vp);
My questions are:
does the address pointed by
res
(address ofint
) satisfy the alignment requirement ofdouble
?does the resulting pointer
res
has an unspecified value?And when I have something like this:
static_cast<double*>(static_cast<void *>(&i))
Doesi
type is not stricter than the target typedouble
? so that the result of this expression is not unspecified