Re: segfault on strtok
From: Al Bowers (xabowers_at_rapidsys.com)
Date: 10/24/03
- Next message: Sheldon Simms: "Re: segfault on strtok"
- Previous message: James Kuyper: "Re: why still use C?"
- In reply to: Andreas Kahari: "Re: segfault on strtok"
- Next in thread: Mark McIntyre: "Re: segfault on strtok"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 24 Oct 2003 09:22:40 -0400
Andreas Kahari wrote:
> In article <3F9912C6.1399@mindspring.com>, pete wrote:
>
>>Andreas Kahari wrote:
>>
>>
>>>Yes, the integer zero is a null pointer, but only if it's cast
>>>to void * and converted into a pointer type.
>>
>>A constant expression with a value of zero,
>>is called a "null pointer constant"
>>(you can find that phrase in the standard),
>>whther or not it's cast to (void*).
>
>
> I was looking at the standard when I wrote it. It says that an
> integer which is zero is a null pointer constant if cast to void *.
> That null pointer constant is a null pointer if converted to
> a pointer type.
>
I believe what you are referring to in the standard is the
section 6.3.2.3 Pointers.
Paragraph:
3. An integer constant expression with the value 0, or such an
expression cast to type void *, is called a null pointer constant.
Notice the word "or". It does not say "only if cast".
Among other posibilities, NULL may be defined as:
0, 0L, 0LL, or (void *)0.
--- Al Bowers Tampa, Fl USA mailto: xabowers@myrapidsys.com (remove the x to send email) http://www.geocities.com/abowers822/
- Next message: Sheldon Simms: "Re: segfault on strtok"
- Previous message: James Kuyper: "Re: why still use C?"
- In reply to: Andreas Kahari: "Re: segfault on strtok"
- Next in thread: Mark McIntyre: "Re: segfault on strtok"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|