Hacker News new | ask | show | jobs
by jwilk 2110 days ago
> void pointers are incremented or decremented by 1 byte.

No, void pointer arithmetic is not allowed by the C standard: https://stackoverflow.com/questions/3523145/pointer-arithmet...

2 comments

That answer does mention that GCC permits it as an extension. If the author uses GCC, maybe that’s where the confusion comes from?
But then he also writes that "sizeof(void) is illegal".

OTOH, GCC documentation says "sizeof is also allowed on void and on function types, and returns 1".

An unfortunate typo there: void pointer arithmetic is not allowed.
Oops! Fixed, thanks.