Re: Return value of malloc(0)
- From: Johannes Weiner <hnazfoo@xxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 06:59:37 +0200
Hi,
On Thu, Jun 29, 2006 at 07:29:16PM +0200, Matthias Andree wrote:
No, sir. Operator precedence: assign first, and then compare, thus the
comparison will always be true (else you'd be comparing to undefined
values, which isn't any better). You might as well write:
foo = malloc(0);
/* make noise */
Ok, just for having it done:
if (foo == (foo = some_val))
.. would be right to check if foo stayed the same. No?
There is no way to see a 0x800 return from malloc(0) as "error".
So noone should actually use malloc(0) and check the size_t argument before
passing it, I guess.
Hannes
--
One must still have chaos in oneself to be able to give
a birth to a dancing star.
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: Return value of malloc(0)
- From: Pat Lashley
- Re: Return value of malloc(0)
- From: Bernd Walter
- Re: Return value of malloc(0)
- 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
- Re: Return value of malloc(0)
- From: Matthias Andree
- Return value of malloc(0)
- Prev by Date: Re: Return value of malloc(0)
- Next by Date: Re: New architecture support
- Previous by thread: Re: Return value of malloc(0)
- Next by thread: Re: Return value of malloc(0)
- Index(es):
Relevant Pages
|
|