Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!pyramid!cbmvax!snark!eric From: eric@snark.UUCP (Eric S. Raymond) Newsgroups: comp.lang.c Subject: Re: Is malloc() or calloc() "better"? Message-ID: Date: 1 Jan 89 17:57:01 GMT References: Organization: Justified Ancients of Muammu Lines: 15 In article , Stanislaw L. Olejniczak writes: > It seems to me that most programmers, in giving examples here, use malloc() > instead of calloc(). It seems to me that, with the headache I always get > thinking of C strings, calloc would be a more common procedure. Would someone > please enlighten me why is malloc so much more popular? The calloc(3) code is just a shell around malloc(3), one that hides a single multiplication and zero-fills the allocated area. I use calloc(3) more myself because I often rely on the zero-fill property, but I often refer to such uses as mallocs because that's what's *really* going on inside the shell. I think other programmers often do likewise; perhaps this is what is confusing you. -- Eric S. Raymond (the mad mastermind of TMN-Netnews) Email: eric@snark.uu.net CompuServe: [72037,2306] Post: 22 S. Warren Avenue, Malvern, PA 19355 Phone: (215)-296-5718