[lkml]   [2003]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: NULL. Again. (was Re: [PATCH] 2.4.22pre10: {,un}likely_p())

Sean Neakums wrote:
> Chip Salzenberg <> writes:
>>According to Jamie Lokier:
>>>Not just K&R. These are different because of varargs:
>>> printf ("%p", NULL);
>>> printf ("%p", 0);
>>*SIGH* I thought incorrect folk wisdom about NULL and zero and pointer
>>conversions had long since died out. More fool I. Please, *please*,
>>_no_one_else_ argue about NULL/zero/false etc. until after reading this:
>> ===[[ ]]===
>>I thank you, and linux users everywhere thank you.
> I had thought that the need for writing NULL where a pointer is
> expected in varags functions was because the machine may have
> different sizes for pointers and int. In the case of the second
> printf call above, if pointers are 64-bit and integers are 32-bit,
> printf will read eight bytes from the stack, and only four will have
> been occupied by the integer 0.

Yes, but you're leaving information out. If you read the FAQ, you'll
find that NULL would not be the right thing to use in some cases. For
instance, (char *)0 may be a different value from (void *)0, so it's
best to cast the pointer when passing to printf or something which uses

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.126 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site