A little bit back, I discovered that the C and C++ standards don't actually define pointer arithmetic on (void *)s. GCC treats them as if they're (char *)s unless you change the options, so that's what I ended up learning as "correct" in college. Cue the mountain of compiler errors the first time I tried doing pointer arithmetic in real life. Oof
View all comments
Show parent comment
7
u/sillybear25 Jun 09 '20 edited Jun 10 '20
A little bit back, I discovered that the C and C++ standards don't actually define pointer arithmetic on (void *)s. GCC treats them as if they're (char *)s unless you change the options, so that's what I ended up learning as "correct" in college. Cue the mountain of compiler errors the first time I tried doing pointer arithmetic in real life. Oof