3 ms·
What I've noticed about C and it's problems with safety is the discussion always assumes that C will be replaced real soon now. So the problem is really about e
by Gibbon1 2y ago
What I've noticed about C and it's problems with safety is the discussion always assumes that C will be replaced real soon now. So the problem is really about existing code bases.
After 40 years of that I think that was a bad assumption.
I also think that with annotations you can fix code mechanically.
You got
void foo(int *__counted_by(N) ptr, size_t N);
That could be replaced mechanically by
void foo(sized_buf_t buffer);
And if it can't that's already a big problem.
- flohofwoe 2y agoYes, easy to do and a good idea in your own code but maybe not an option in a library that needs to remain API and ABI compatible with the previous version of the library that used separate ptr and size arguments (for whatever reasons - for instance Apple might want to harden system libraries without breaking existing applications).