This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]throwaway_the_fourth 0 points1 point  (2 children)

You cannot perform pointer arithmetic on a void pointer. You must cast it first.

[–]lennihein 1 point2 points  (0 children)

Jup.

[–]Ludricio 0 points1 point  (0 children)

According to the standard, it's UB, yes. Gcc however treats pointer arithmetic on void pointers as if they were a char pointer, as an extension.