Return value of malloc(0)
matthias.andree at gmx.de
Fri Jun 30 02:14:25 UTC 2006
On Thu, 29 Jun 2006, Harti Brandt wrote:
> Operator precedence is just for parsing, not for evaluation. The
> compiler may well first evaluate the foo on the right side of the == (by
> fetching it) and then go an call malloc and assign foo.
Right, thanks for reminding me. I don't usually write code that depends
on evaluation order... except with the short-circuiting stuff || or &&.
splint 3.1.1 complains about this issue BTW, but neither GCC 4.1.0 nor
ICC 8.1.028 on Linux nor FreeBSD lint complain. I used gcc -Wall which
is specified to include -Wsequence-point...
> It is actually undefined behaviour, I think, so it may well make explode
> your near-by atom power plant.
It had better not...
More information about the freebsd-hackers