On Wed, Jun 30, 2004 at 14:37:09 +0530, Anupam Kapoor wrote: > a literal '0' in pointer context always means a null pointer. what > happens if for example on some platform, a null pointer is defined as > 0xdeadbeef ? It's simple. The compiler always knows when it's converting integer to pointer or vice versa. So it inserts appropriate code. There actualy is a compiler, that has many different NULL pointers. Each time you use NULL pointer in the source, or use an uninitialized pointer variable, it uses a different one. So if the program crashes, it can tell you where the pointer was set to NULL. It inserts appropriate code so that NULL == NULL, though the memory representation is different and that NULL == 0, though the memory representation is different. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Digital signature