4 ms·
I would want it to be based on references and slices, both nullable and non-nullable. References don't allow pointer magic, therefore are always in bounds. Slic
by legulere 11y ago
I would want it to be based on references and slices, both nullable and non-nullable. References don't allow pointer magic, therefore are always in bounds. Slices only allow sub slicing, therefore they're also always within bounds (dereferencing them would need bounds checks to be safe though).
The great problem of C is that almost everything is a pointer and they potentially can all be invalid. On top of this there's no easy way to check wether they are valid. This is the reason, why memory safety is so hard to get right with C.