On Wed, Jun 30, 2004 at 12:25:22 +0300, Nir Tzachar wrote: > > > i dont see your point. this has nothing to do with the NULL pointer, but > > > with a pointer whose base address is 0, which saves the subtraction... > > > as far as this macro concerns, NULL may be defined like this: > > > #define NULL ((void *)400) > > > > No, it may not! Numeric 0 must convert to NULL pointer and vice versa > > (if for nothing than for the fact, that NULL must be FALSE). Noone > > said, that the typecast does not add some code though, so the real > > memory representation may not be all zeroes. > > as i've said b4, i dont see what this macro has to do with the memory > representation of the null pointer. > the ((type *)0) member is used to get a pointer to a struct 'type', > which is located at address 0 -> hence, the address of the member is its > offset in the struct. nothing to do with actual memory... No. ((type *)0) is used to get a NULL pointer of given type. The C specification DOES say 0 must convert to NULL and does NOT say it must be located on address 0. In gcc, it always is, though. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Digital signature