hello everyone I have this snippet of the code:
void writer(void* param){
if(NULL == param){
return;
}
param = (param_t*)param;
...
}
is it safe code, or not, param is from type param_t*, but I’m sick doing every time casting when I use it in function, do Somebody have another elegant solution? thanks in advance
That is a strange no-op.
When you define the function you say param is of type
void*.Then, with the cast, you explicitly convert it to
param_t*And the compiler implicitly converts that
param_t*tovoid*with the assignment.You need another variable