calloc idiocy
Posted Aug 14, 2005 23:03 UTC (Sun) by
chad.netzer (
✭ supporter ✭, #4257)
In reply to:
calloc idiocy by giraffedata
Parent article:
kzalloc()
Ahh, I see. I did ignore the clearing aspect in my replies; I overlooked this as the the distinction that perhaps you (and bronson) were talking about. But I hope all this does illustrate to bronson (if he or she is reading) that calloc() requires the "nmemb" argument for a reason, and that the overflow protection is easy to overlook, but an important feature of calloc().
Ok, I understand your macro example now. A compact way of doing the array allocation without the clear, and safer than malloc(n * sizeof(struct foo)). Thanks for rewriting the declaration.
Cheers.
(
Log in to post comments)