On Mon, Jul 11, 2005 at 05:37:37PM +0200, Felix Nawothnig wrote:
> [EMAIL PROTECTED] wrote:
> >I believe that assignment should be the same as,
> >
> >  x = 0;
> 
> No. Casting a pointer to an integer results in undefined behaviour (in 
> ANSI/ISO C)

In C99, the implementation can optionally provide the types intptr_t and
uintptr_t.  In that case you can reliably convert a void pointer to one
of those types and back again.

That said, it is unlikely that intptr_t would be the same type as
char.  And even if those types are present, the standard still doesn't
guarantee any correspondence between a specific integer value and a
specific pointer value; merely that a pointer can be converted to some
integer value that then converts back to the same pointer again.

The standard definitely does not guarantee that a null pointer is the
same as all-bits-zero.  There have been a few real implementations
that used nonzero bits.

  http://www.eskimo.com/~scs/C-faq/q5.17.html

                                                  -Dave Dodge


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to