3 ms·
So I suppose that header = (struct header_t*)(block - 1); would be UB then.
by dsamarin 8y ago
So I suppose that header = (struct header_t*)(block - 1); would be UB then.
- mav3rick 8y agoHaven't read the article but if block is void *, this won't compile because sizeof(void) is not defined. And they are probably trying to subtract the sizeof(struct header) hence the expression in your original comment.
- tom_ 8y agogcc actually lets you do this: https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Pointer-Arith.html#Pointer-Arith https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Pointer-Arith.h...