On Mar 28, 2005, at 9:39 PM, [email protected] wrote:
On Mar 28, 2005, at 9:39 PM, [email protected] wrote:
I already posted one, posts ago.
[snip]
Imporved version:
[snip]
char *dummy = (char *)malloc(1);
That cast is not supposed to be there, is it? (To pretake it: it's
bad.)
What is so bad about it?
Read the FAQ at http://www.eskimo.com/~scs/C-faq/q7.7.html
Malloc() returns a void*, so casts are superfluous if stdlib.h is
included (as it should be). Hence if one typecasts the result of malloc
in order to suit any particular type, the real bug is probably a
lacking "#iinclude <stdlib.h>", which the cast (effectively) is hiding.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]