|
|
|
|
|
by planteen
3544 days ago
|
|
That might not necessarily work. If you have something like: >> uint8_t x[100]; >> uint32_t *y = &x[1]; And then dereference y, most RISC architectures will trap on the unaligned access. It doesn't matter if there is an intermediate void pointer or not. |
|
According to my reading an intermediate void pointer allows the pointer casting to stay well defined. However this seems unsafe, even without getting into dereferencing, because implementations are allowed to store omit bits if they assume aligned pointers.