Falk Hueffner wrote:
Jason Kraftcheck <kraftche@cae.wisc.edu> writes:The C standard says there's a difference between printing a void* and a int* (or any other type)? How can a pointer passed through a var-args list be anything but a void*? The C standard may say that %p prints a void*, but isn't any pointer passed through a var-args a void*?I don't see that anywhere in the standard. As I see it, only the default argument conversions are executed, which does not include this conversion.
In practice, how can it be anything other than a void*? Anyway, the warning is meaningless regardless. Changing printf("%p\n", &i); to printf("%p\n", (void*)(&i));makes the warning go away. There is no case where such a cast can possibly make any difference in the output. For situations where casts can actually change the value of a pointer (e.g. C++ objects), void* is the one case where that is guaranteed not to happen. The warning is useless noise. Or am I missing something fundamental here?