Hacker News new | past | comments | ask | show | jobs | submit login

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



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].


Hmm, maybe?

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




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: