From: Stephan T. Lavavej [MSFT] on
void is an incomplete type and void * is a complete type.

STL

"Ulrich Eckhardt" <eckhardt(a)satorlaser.com> wrote in message
news:5nef47-vk4.ln1(a)satorlaser.homedns.org...
> Igor Tandetnik wrote:
>> Ulrich Eckhardt wrote:
>>> A void pointer doesn't have any type
>>
>> This is not true formally, and I don't think it's useful to think this
>> way
>> informally either: 6.2.5p19 The void type comprises an empty set of
>> values; it is an incomplete type that cannot be completed.
>
> The type defines the behaviour of an instance, all instances of the same
> type share similar behaviour. Since void is incomplete, you can never have
> any instances of it. An empty set of values means pretty much the same,
> that it can't exist.
>
> In that context, calling void a placeholder for the lack of a type is a
> reasonable description to me. Agreed, it is not formally true, since the C
> standard uses a different meaning, but informally that description is
> useful.
>
> Uli
>
> --
> C++ FAQ: http://parashift.com/c++-faq-lite
>
> Sator Laser GmbH
> Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

From: Tim Roberts on
"Pavel A." <pavel_a(a)12fastmail34.fm> wrote:
>
>There may be a real memory location with adress 0 (either code or data or
>both),
>so dereferencing "null pointer" may be possible physically - especially
>on small microcontrollers like what the OP struggles against.
>On most "normal" VM systems, both code and data null locations are
>excluded from virtual space of a process, so they cause exception.

Yes. NULL is an interesting beast. Although it's literal bit-pattern
value might not be all zeros, the standard requires that a null pointer
BEHAVE in expressions as though it were the integer 0.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Barry Schwarz on
On Sat, 13 Feb 2010 12:18:41 -0800, Tim Roberts <timr(a)probo.com>
wrote:

>"Pavel A." <pavel_a(a)12fastmail34.fm> wrote:
>>
>>There may be a real memory location with adress 0 (either code or data or
>>both),
>>so dereferencing "null pointer" may be possible physically - especially
>>on small microcontrollers like what the OP struggles against.
>>On most "normal" VM systems, both code and data null locations are
>>excluded from virtual space of a process, so they cause exception.
>
>Yes. NULL is an interesting beast. Although it's literal bit-pattern
>value might not be all zeros, the standard requires that a null pointer
>BEHAVE in expressions as though it were the integer 0.

Not at all. Assuming a prototype for printf in scope,
void *p = 0;
printf("%p\n", p);
would invoke undefined behavior if the null pointer p were to behave
as an int.

A null pointer always behaves like a pointer. The only time it has
any relation to the integer 0 is when it is being assigned the null
pointer constant value 0 or when it is being compared to the null
pointer constant value 0. In the latter case one could loosely argue
the pointer is behaving as an integer but the standard makes it very
clear the integer is behaving as a pointer.

--
Remove del for email
From: Ulrich Eckhardt on
Stephan T. Lavavej [MSFT] wrote:
> void is an incomplete type and void * is a complete type.

....and your point is what?

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932