I have used the --host-compilation=C argument which according to the documentation uses the C language instead of C++ for compiling the host code (i prefer C to C++). However the following:
float* a;
hst_a = malloc(sizeof(float)*n);
while valid C code, produces an error:
test1.cu(28): error: a value of type "void *" cannot be assigned to an entity of type "float *"
if i add a typecast
hst_a = (char*)malloc(sizeof(float)*n);
then it works, but this is required only in C++, not C.
Isn’t this a bug in nvcc? Am i missing something? This isn’t a serious issue, but i would like to avoid all the unneeded typecasts.