Re: NULL with representation other then all bits 0
- From: Jordan Abel <random832@xxxxxxxxx>
- Date: 29 Jan 2006 01:01:42 GMT
On 2006-01-28, Jack Klein <jackklein@xxxxxxxxxxx> wrote:
> On Sat, 28 Jan 2006 13:48:49 +0000 (UTC), "Vladimir S. Oka"
> <novine@xxxxxxxxxxxxxxx> wrote in comp.lang.c:
>
>> yossi.kreinin@xxxxxxxxx wrote:
>> > - AFAIK I can't `#define NULL 0x10000' since `void* p=0;' should work
>> > just like `void* p=NULL'. Is this correct?
>>
>> Yes and no. Yes, if you're compiler writer, and on your implementation
>> NULL pointer representation is 0x10000, so you defined it thus in the
>> standard header files. No, if you're trying to re-define NULL in your
>> own C program. The part of your sentence after `since` is irrelevant in
>> this context (but true).
>
> No, even if you are a compiler writer, you cannot define the macro
> NULL as something like (void *)0x10000. Not if you want your compiler
> to conform to the C language standard.
>
> The macro NULL is required by the standard to be an
> implementation-defined null pointer constant, and the meaning of "null
> pointer constant" is precisely defined by the standard:
>
> "An integer constant expression with the value 0, or such an
> expression cast to type void *, is called a null pointer constant."
>
> The expression (void *)0x10000 is neither of the two allowed forms.
I think you have a funny definition of "implementation-defined".
.
- Follow-Ups:
- Re: NULL with representation other then all bits 0
- From: Jack Klein
- Re: NULL with representation other then all bits 0
- From: Keith Thompson
- Re: NULL with representation other then all bits 0
- From: Peter Nilsson
- Re: NULL with representation other then all bits 0
- References:
- NULL with representation other then all bits 0
- From: yossi . kreinin
- Re: NULL with representation other then all bits 0
- From: Vladimir S. Oka
- Re: NULL with representation other then all bits 0
- From: Jack Klein
- NULL with representation other then all bits 0
- Prev by Date: Re: advantage of using typedefs
- Next by Date: Re: NULL with representation other then all bits 0
- Previous by thread: Re: NULL with representation other then all bits 0
- Next by thread: Re: NULL with representation other then all bits 0
- Index(es):
Relevant Pages
|