3 ms·
> pointer decay This is an issue? Works fine for me.
by jstimpfle 4y ago
> pointer decay
This is an issue? Works fine for me.
- pjmlp 4y agoIt does wonders for security researchers jobs, because the idea of typing &arr[0] instead was asking too much.
- jstimpfle 4y agoWhy _can_ you write &arr[0] in the first place? There is at least some logic behind it (which probably breaks down with multidimensional arrays, a feature that probably wasn't there from the start). In C, I suspect that at least in the beginning, there were never arrays on the type and expression level - only pointers. What security problems are exactly caused by pointer decay? A similar thing also exists with calls through function pointers, and I do not think you can find many programmers who are willing to write (*foo)(x, y, z) when using function pointers (at least not when there are many, like when using e.g. OpenGL). Or worse, (&foo)(x, y, z) with normal functions.
- pjmlp 4y agoThe usual stuff that array lengths on function declarations are only guidelines, given that they are plain pointers, and when one calculates the array length not taking that into account, somewhere out there there is an happy hacker.