10 ms·
The D language dynamic array, which is a pointer+length pair, has (over time) nearly completely supplanted pointer arithmetic. The pair prevents buffer overflow
by WalterBright 3y ago
The D language dynamic array, which is a pointer+length pair, has (over time) nearly completely supplanted pointer arithmetic. The pair prevents buffer overflows and underflows.
Raw pointer arithmetic is not allowed in code marked @safe.
I've proposed it for C and C++:
https://www.digitalmars.com/articles/C-biggest-mistake.html https://www.digitalmars.com/articles/C-biggest-mistake.html
It would be simple to add it, and would be legacy compatible.