void-pointers

C->C++ Automatically cast void pointer into Type pointer in C++ in #define in case of type is not given (C-style) [MSVS]

Hi! I've used the following C macro, But in C++ it can't automatically cast void* to type*. #define MALLOC_SAFE(var, size) { \ var = malloc(size); \ if (!var) goto error; \ } I know, I can do something like this: #define MALLOC_SAFE_CPP(var, type, size) { \ var = (type)malloc(size); \ if (!var) goto error; \ } But ...