Conversation

Is taking a pointer to the interior of a contiguously-laid-out array, then shortening the length of the array and dereferencing that now-dangling pointer, a spatial or temporal memory safety violation? Seems to me that the distinction gets very blurred in this case.
7
16
Replying to and
You're interpreting array as the C meaning of array rather than as a generic term which in this case is referring to a dynamic array, i.e. a layer on top of malloc/realloc/free with a separate length/capacity where growing/shrinking capacity invalidates references into it.
1
Show replies