J
Jeroen Schot
Hello,
In a recent thread[1] on StackOverflow there was the question of passing
an int where void * was expected. Of course this is not well defined.
But what surprised me is that people remarked that passing an intptr_t
might not work either.
Given this example:
#include <stdint.h>
int foo(void *p)
{
intptr_t i = p;
...
}
...
intptr_t n = 5;
foo(n);
...
Is it true that i might not be equal to n because the standard only
specifies the conversion (void *) -> (intptr_t) -> (void *) and not
(intptr_t) -> (void *) -> (intptr_t)? If so, why?
[1]: http://stackoverflow.com/q/3811171/251122
Regards,
In a recent thread[1] on StackOverflow there was the question of passing
an int where void * was expected. Of course this is not well defined.
But what surprised me is that people remarked that passing an intptr_t
might not work either.
Given this example:
#include <stdint.h>
int foo(void *p)
{
intptr_t i = p;
...
}
...
intptr_t n = 5;
foo(n);
...
Is it true that i might not be equal to n because the standard only
specifies the conversion (void *) -> (intptr_t) -> (void *) and not
(intptr_t) -> (void *) -> (intptr_t)? If so, why?
[1]: http://stackoverflow.com/q/3811171/251122
Regards,