Quote Originally Posted by laserlight View Post
It is more flexible, and appropriate sanity checks can still be done in the calling code. Also, there is no reason why this primary interface cannot be extended by wrappers for arrays and containers.
I am not going to complain about the design. It's good. It just needs sanity checks, which is what I am trying to get out there--that the code lacks sanity checks and that they are good. I'd prefer the callee do the checks, though.

Quote Originally Posted by whiteflags View Post
If we coded a function the way you recommended, it would not be compatible with vector anyway. A function with a pointer and a size argument is. Before you come back with something ridiculous, maybe it doesn't matter where the memory is allocated, so coding another function to handle it would not be ideal.
A function with a pointer and size is error prone. It's the C way. Hence, if you can avoid that (and if you are writing C++, then most of the time you CAN), then you SHOULD.
As for how to code a safe function that takes both vectors and arrays--or something else, for that matter--is something I don't know yet. I haven't experimented with it enough because I tend to use minimalist interfaces.