top | item 32585337

(no title)

vukgr | 3 years ago

Can't say I've really thought this through, but couldn't you just subtract 1 (*sizeof(X)) from the arr address?

discuss

order

tremon|3 years ago

What would memset(arr, 0, sizeof(arr)) do in that case? I can see myriad problems with having arr itself point outside the memory range allocated to arr[min..max].

saalweachter|3 years ago

Hmm, maybe?

You'd still have the odd subtract here or there, but for many use patterns you could probably ignore the overhead.