lkml.org 
[lkml]   [2007]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kmalloc() with size zero
Stephane Eranian wrote:
> Hi,
>
> On Sun, Mar 25, 2007 at 06:30:34PM +0200, Folkert van Heusden wrote:
>>>> I'd say "feature", glibc's malloc also returns an address on
>>>> malloc(0).
>>>>
>>> This is implementation defined-the standard allows for return of either
>>> null or an address.
>> Entirely for entertainment: AIX (5.3) returns NULL, IRIX returns a valid
>> address.
>>
> That's interesting, so many different behaviors! Personally, I still prefer
> when malloc(0) returns zero because it makes it easier to catch errors.
>
Exactly, the address returned is not really useful, the improved error
checking is useful.

--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-29 16:43    [W:0.333 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site