6 ms·
Can't say I've really thought this through, but couldn't you just subtract 1 (*sizeof(X)) from the arr address?
by vukgr 4y ago
Can't say I've really thought this through, but couldn't you just subtract 1 (*sizeof(X)) from the arr address?
- saalweachter 4y agoHmm, maybe? You'd still have the odd subtract here or there, but for many use patterns you could probably ignore the overhead.
- tremon 4y agoWhat 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].