Re: Return value of malloc(0)
- From: Harti Brandt <hartmut.brandt@xxxxxx>
- Date: Thu, 29 Jun 2006 18:53:34 +0200 (CEST)
On Thu, 29 Jun 2006, Johannes Weiner wrote:
JW>On Thu, Jun 29, 2006 at 06:09:37PM +0200, Matthias Andree wrote:
JW>
JW>> The value returned from malloc(0) must not be dereferenced whatever it
JW>> was. It was 0x800, which doesn't count as "failure".
JW>
JW>But this would be appropriate for catching the error:
JW>
JW>if ((foo = malloc(0)) == foo)
JW> /* make noise */
JW>
JW>wouldn't it?
Wouldn't it rather invoke undefined behaviour?
harti
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- Return value of malloc(0)
- From: Andre Albsmeier
- Re: Return value of malloc(0)
- From: Johannes Weiner
- Re: Return value of malloc(0)
- From: Matthias Andree
- Re: Return value of malloc(0)
- From: Johannes Weiner
- Return value of malloc(0)
- Prev by Date: Re: NVIDIA FreeBSD kernel feature requests
- Next by Date: Re: Return value of malloc(0)
- Previous by thread: Re: Return value of malloc(0)
- Next by thread: Re: Return value of malloc(0)
- Index(es):