C
Charlie Zender
Hi,
I have a function that takes a void pointer (vp) input prototyped as
const void * const vp
Thus vp is a constant pointer to a void which is const.
This routine passes vp to another routine that expects a
const char **vp
Thus it expects a pointer to a pointer to a char which is const.
Hence when the first routine passes vp to the second routine,
it uses an explicit cast
(const char **)vp
The compiler (gcc 4.3.x) completes this cast but warns me:
attention : passing argument 4 of ‘nc_put_var1_string’ from
incompatible pointer type
I thought C allowed casting void pointers to any other pointers.
What is the correct way to cast vp so as not to get a warning?
Is casting a singly-indirect pointer to a doubly-indirect ever
warning-free?
Thanks,
Charlie
I have a function that takes a void pointer (vp) input prototyped as
const void * const vp
Thus vp is a constant pointer to a void which is const.
This routine passes vp to another routine that expects a
const char **vp
Thus it expects a pointer to a pointer to a char which is const.
Hence when the first routine passes vp to the second routine,
it uses an explicit cast
(const char **)vp
The compiler (gcc 4.3.x) completes this cast but warns me:
attention : passing argument 4 of ‘nc_put_var1_string’ from
incompatible pointer type
I thought C allowed casting void pointers to any other pointers.
What is the correct way to cast vp so as not to get a warning?
Is casting a singly-indirect pointer to a doubly-indirect ever
warning-free?
Thanks,
Charlie