Re: offsetof() macro
- From: DevarajA <no@xxxxxxxx>
- Date: Fri, 09 Sep 2005 08:19:47 GMT
There are those who advocate using 0 rather than the NULL macro as a null pointer constant. They are, of course, wrong, since they disagree with me.
(If I were designing the language from scratch, there would be a keyword, either "nil" or "null", that would be the *only* null pointer constant. Using 0 in a pointer context would be a constraint error.
What do you mean by "using 0 in a pointer context"? In another post you have said "An integer constant 0 is a valid null pointer constant. If you assign a null pointer constant to a pointer object, that object's value at execution time will be a null pointer."+"The macro NULL expands to a null pointer constant." And now you say that using 0 is a constraint error. I think I haven't understood yet :-(
And on every compiler I've tried, int *pt=0; works without errors or warnigs. And also the standard says that a constant expression evaluating to 0 or such an expression cast to void*, assigned to a pointer of wathever type makes it a null pointer.
Sorry if I'm wasting your time, but I'm a bit confused...
-- Devaraja (Xdevaraja87^gmail^c0mX) Linux Registerd User #338167 http://counter.li.org .
- Follow-Ups:
- Re: offsetof() macro
- From: Keith Thompson
- Re: offsetof() macro
- From: Irrwahn Grausewitz
- Re: offsetof() macro
- References:
- offsetof() macro
- From: Simon Morgan
- Re: offsetof() macro
- From: Kenneth Brody
- Re: offsetof() macro
- From: Eric Laberge
- Re: offsetof() macro
- From: DevarajA
- Re: offsetof() macro
- From: Flash Gordon
- Re: offsetof() macro
- From: DevarajA
- Re: offsetof() macro
- From: Keith Thompson
- Re: offsetof() macro
- From: DevarajA
- Re: offsetof() macro
- From: Keith Thompson
- offsetof() macro
- Prev by Date: Re: Question: Overflow
- Next by Date: Re: sine inverse of something
- Previous by thread: Re: offsetof() macro
- Next by thread: Re: offsetof() macro
- Index(es):
Relevant Pages
|
Loading