Re: Paying developers to get features faster

From: Bill Unruh (unruh_at_string.physics.ubc.ca)
Date: 01/25/04


Date: Sun, 25 Jan 2004 17:16:12 +0000 (UTC)

Barry Margolin <barmar@alum.mit.edu> writes:

]In article <5ih610dbsgsg0q0q8o55oes7ufejrt0a77@4ax.com>,
] Brad Olin <bwo@bwo1.com> wrote:

]> Are you sure? The case I was referring to was a page mode address
]> processor. Page zero, offset zero was a valid RAM address and you were
]> allowed to point to it. That package defined NULL as something like...
]>
]> #define NULL const (void *)0x800000

]This is a violation of the ANSI/ISO C specification. It says that a
]null pointer is an integer constant zero or an integer constant zero
]cast to void*, and that the NULL macro expands to one of these (there's
]been a thread for the past 3-4 weeks in comp.std.c about this, and all
]the experts agree on this).

]> As I remember it, they had an on-chip MMU that trap'd or NMI'd the CPU
]> if you read/wrote with the MSB set. It's been a few years and I no
]> longer have access to that project.

]The compiler is supposed to translate the syntactic representation of
]the null pointer to the appropriate binary representation. So when it
]see (void*)0 or 0 in a pointer context, it should generate code that
]uses 0x800000 internally if that's what the CPU requires.

So, how do you point to the valid pointer value 0?

In his case he clearly needs to differentiate between an invalid pointer
and the pointer value of 0, and be able to use both in the program.
Simply making the pointer value 0 be an impossible pointer value does
not solve the problem.



Relevant Pages

  • Re: Paying developers to get features faster
    ... ]null pointer is an integer constant zero or an integer constant zero ... they had an on-chip MMU that trap'd or NMI'd the CPU ... ]the null pointer to the appropriate binary representation. ...
    (comp.os.linux.misc)
  • Re: Paying developers to get features faster
    ... ]null pointer is an integer constant zero or an integer constant zero ... they had an on-chip MMU that trap'd or NMI'd the CPU ... ]the null pointer to the appropriate binary representation. ...
    (comp.security.misc)
  • Re: Paying developers to get features faster
    ... ]null pointer is an integer constant zero or an integer constant zero ... they had an on-chip MMU that trap'd or NMI'd the CPU ... ]the null pointer to the appropriate binary representation. ...
    (comp.os.linux.security)
  • Re: NULL with representation other then all bits 0
    ... has "integer constant zero" as the value to be assigned. ... the compiler, you check, and you GENERATE DIFFERENT CODE! ... might be comparing a pointer to integer-constant-zero, ... *should* have used a cast: ...
    (comp.lang.c)
  • Re: Paying developers to get features faster
    ... >]null pointer is an integer constant zero or an integer constant zero ... >]The compiler is supposed to translate the syntactic representation of ... >]the null pointer to the appropriate binary representation. ...
    (comp.os.linux.development.system)