It doesn't sound impossible to me but I know nothing about compiler development :)
It doesn't sound impossible to me but I know nothing about compiler development :)
Rolling out this sort of change across a large codebase is hard as shit. While it sounds like it is mostly transparent, as soon as you run into a sufficiently large codebase all sorts of things start blowing up that you need to fix by hand before such a feature can be rolled out.
You can also do this with pointer tagging and some other techniques, but without hardware support this is amazingly slow. You can see just how much slower an asan build is, for example.
There are some big issues with this:
1. It's slow. Symbolic execution involves the interpretation of your program.
2. It would be imperfect and you'd likely have false positives.
3. It would likely be incomplete - for example, how would you handle the situation of only having a header?
So it's a good idea but it's very hard to make practically useful.
Where?
Once you have a bare pointer, you've lost track of what the original definition might have been, so you (the compiler / runtime / programmer) have no way of knowing that you've exceeded the size.
https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Object-Size-Che...
Which is why I harp on the idea that the real problem is the gold bricks on WG14 who are intentionally blocking improvements to make C safer.
Also point out that if you can implement C on 16bit 0x86's segmented architecture you can certainly implement C with phat pointers too.
Or it's hard like everyone keeps saying.
I'm going with the second option