Does anyone know how (or whether it's possible) to perform runtime bounds checking in C++?
I know that if you have:
then you can perform:
size_t sz = sizeof(ch);
and you can know on runtime what the size of the ch array is. But is there a way to do similar thing on pointers allocated with malloc or free? It will be very useful for debugging / avoiding catasptrophic failure!