Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> remembers buffers' size

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.



That's not true, it is merely true on most ABIs. The only case where C really erases this information is casting to uintptr_t and back.


Unless it is clearly specified on the ISO C standard, it is true in practice, and something that is impossible to rely on.


gcc also has some builtins to check pointer sizes when the compiler is able to figure it out.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: