Hi all,
My compiler (icc) is generating a warning that confuses me:
PXVec.c(305): warning #167: argument of type "double *restrict *" is incompatible with parameter of type "void *"
free( Value );
^
In a struct, I have:
typedef struct{
double * restrict * restrict Value; //an array of pointers
} PX_Vec;
Then in some code...
destroy(PX_Vec *Xvec){
free(Xvec->Value); //Value previously malloc'ed as malloc(size*sizeof(double *));
}
Why am I getting a warning on this? Is there any way around it?
Thanks,
-Eric
Edit: I have another question too...
When you're using double ** to mean "an array of pointers", does it even make sense to put restrict twice?
If it matters, the idea is to have a large block of memory (double *Data) divided into numChunks chunks of varying size. Then the "Value" pointer array has numChunks pointers, each one pointing to the start of a new chunk in the array Data.
Then operations on the elements of Data will either be carried out indexing from the "Data" pointer directly OR from the "Value" pointer, but never both simultaneously.
So when looking inside Data or Value, I want the compiler to know that this array is not aliased to anything else.
My compiler (icc) is generating a warning that confuses me:
PXVec.c(305): warning #167: argument of type "double *restrict *" is incompatible with parameter of type "void *"
free( Value );
^
In a struct, I have:
typedef struct{
double * restrict * restrict Value; //an array of pointers
} PX_Vec;
Then in some code...
destroy(PX_Vec *Xvec){
free(Xvec->Value); //Value previously malloc'ed as malloc(size*sizeof(double *));
}
Why am I getting a warning on this? Is there any way around it?
Thanks,
-Eric
Edit: I have another question too...
When you're using double ** to mean "an array of pointers", does it even make sense to put restrict twice?
If it matters, the idea is to have a large block of memory (double *Data) divided into numChunks chunks of varying size. Then the "Value" pointer array has numChunks pointers, each one pointing to the start of a new chunk in the array Data.
Then operations on the elements of Data will either be carried out indexing from the "Data" pointer directly OR from the "Value" pointer, but never both simultaneously.
So when looking inside Data or Value, I want the compiler to know that this array is not aliased to anything else.
Last edited: