Re: offsetof
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Sep 2005 15:55:02 +0100
darkknight wrote:
On Sat, 01 Oct 2005 01:20:28 +1200, darkknight wrote:
On Fri, 30 Sep 2005 13:27:44 +0100, Flash Gordon wrote:
darkknight wrote:
<snip stuff that seems about right>
The expression (type*)0 does NOT create a NULL pointer constant unless the type of "type" is void i.e. it is (void*)0.
Wrong. It explicitly IS a null pointer constant of the specified type. In fact, with (type*)0 the 0 is a null pointer constant and, at run time, it explicitly gives you a null pointer.
Please quote the relevant sections of the standard to support your claim.
Never mind. I found it. You are right.
There was me about to admit that whilst the 0 in the above is a null pointer constant, and you do get a null pointer of the specified type, you don't get a null pointer *constant* of the specified type. A subtle point perhaps, and not one that affects programming in practice, but possible valid. :-)
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
.
- References:
- offsetof
- From: luke
- Re: offsetof
- From: darkknight
- Re: offsetof
- From: darkknight
- offsetof
- Prev by Date: Re: Detecting Reads of Global Uninitialized Variables
- Next by Date: Re: size of pointer in C?
- Previous by thread: Re: offsetof
- Next by thread: Using make
- Index(es):
Relevant Pages
|