insert cast in TMP_ALLOC for C++ compatibility