Hi!
I\'ve used the following C macro, But in C++ it can\'t automatically cast void* to type*
void*
type*
For example, like this:
template void malloc_safe_impl(T** p, size_t size) { *p = static_cast(malloc(size)); } #define MALLOC_SAFE(var, size) { \ malloc_safe_impl(&var, size); \ if (!var) goto error; \ }