medovikov
06-03-2002, 01:44 PM
I have 'void *' : unknown size compilation error
in line
return v - size*(nl-NR_COMPATIBLE);
I use Visual C++. This line is OK for g++ compilers because
it uses char * instead of void * (as far as I know).
What should be done to avoid this error in Visual C++?
Thanks.
/*
* memory allocator for any type of vector, matrix, tensor < vmtlib.c >
*
* VMT: Vector Matrix Tensor lib, Numerial Recipes in C compatible
*
* Copyright (C) 1999 Taiji Yamada
*/
void *(vector_alloc)(size_t size, long nl, long nh)
{
void *v = malloc(size*(nh-nl+1+NR_COMPATIBLE));
if (!v)
return NULL;
else
return v - size*(nl-NR_COMPATIBLE); //THIS LINE
}
in line
return v - size*(nl-NR_COMPATIBLE);
I use Visual C++. This line is OK for g++ compilers because
it uses char * instead of void * (as far as I know).
What should be done to avoid this error in Visual C++?
Thanks.
/*
* memory allocator for any type of vector, matrix, tensor < vmtlib.c >
*
* VMT: Vector Matrix Tensor lib, Numerial Recipes in C compatible
*
* Copyright (C) 1999 Taiji Yamada
*/
void *(vector_alloc)(size_t size, long nl, long nh)
{
void *v = malloc(size*(nh-nl+1+NR_COMPATIBLE));
if (!v)
return NULL;
else
return v - size*(nl-NR_COMPATIBLE); //THIS LINE
}