3 ms·
end-start is the length - I didn't think given the context I needed to be that precise. The important thing is that the ABI for an array does not match C's beca
by olliej 3y ago
end-start is the length - I didn't think given the context I needed to be that precise. The important thing is that the ABI for an array does not match C's because it has additional data that C doesn't provide, so can't interoperate with C.
"C can get new types" isn't a solution to the problem, this RFC does add such (indexable and bidi_indexable), but that does nothing to help existing code.
If a solution to bounds checking in C means you can't recompile an existing library with bounds safety, without breaking existing users of those libraries it's insufficient, because it means that it can't be used for the huge amount of existing C. If a project is new then it can just use a safe language in the first place.
- pjmlp 3y agoPrecision matters, when end pointers are used there is no limit for the string/array size, as it is traditional argument the C folks use against bounds checked data structures. "C can get new types" is definitly a solution, one where new types can be incremently used and with time transition existing code bases to the new types. By your own words, "C can get compiler annotations" is not a solution for the problem as well, someone has to write the code that uses those annotions, hardly any different from using new types.