Ahsan
August 29, 2003, 9:07pm
1
The gcc compiler is giving following error in my code. Can Anyone help, why is this warning popping up.
"void format, different type arg (arg 1)"
The function's on which warning is given, looks like this:
void fprint_stderr_sockarray(int* sockets)
{
..........
..........
}
Ahsan
August 29, 2003, 10:30pm
2
Sorry All,
The warning comes on the inner line of this function. The line is:
fprintf(stderr,
" } at %p size %d\n",sockets,((MAX_TCPCLIENTS)*(sizeof(int))));
Now sockets is an integer pointer and %p would accept a void pointer. Ca I safely type cast sockets to void pointer?
Waiting for response,
Ahsan
kowrip
September 10, 2003, 12:33pm
3
Adding a (void *) type cast should stop the gcc compiler from complaining. Since pointers are just memory addresses, it makes no differences what it's pointing to if you just want to print out the address.