Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
dsamarin
7y ago
0 comments
Save
Share
So I suppose that header = (struct header_t*)(block - 1); would be UB then.
0 comments
2 comments · 1 top-level
top
newest
oldest
mav3rick
7y ago
· 1 in thread
Haven'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_
7y ago
gcc actually lets you do this:
https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Pointer-Arith.h...
j
/
k
navigate · click thread line to collapse