In C you could write or have a macro which does the cast.
int *p = malloc(sizeof *p);
In C++ you would have to add an explicit cast, which would not make it safer: int *p = (int*)malloc(sizeof char);
So from a type system perspective this is not safer.