Re: inline asm question(s)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 30, 2004 at 12:43:24 +0300, Nir Tzachar wrote:
> On Wed, 30 Jun 2004, Jan Hudec wrote:
> 
> > > 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.
> 
> thats my point. i dont care about C specifications, as u said before, but 
> what gcc does. if ((type *)0) was not located at address 0, this macro 
> would not work.

Yes. Well, though, it could still be saved. It's the condition that:
(char *)a - (char *)b == (int)a - (int)b, that's relied upon. If, eg.
all addresses were moved by a constant, it would still work.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux