That's Objective-C.
int* foo = malloc(sizeof(int));
Is invalid C++. int* foo = malloc(sizeof(int));
Is invalid C++. int* foo = (int*)malloc(sizeof(int));
in C++ or the compiler gives a type error.