I am wondering whether the C or C++ standard guarantees that a pointer is not changed when realloc is called with a smaller (nonzero) size:
size_t n=1000; T*
http://opengroup.org/onlinepubs/007908775/xsh/realloc.html
Upon successful completion with a size not equal to 0, realloc() returns a pointer to the (possibly moved) allocated space.
Nope, no guarantee