19 Jul, 2009, JohnnyStarr wrote in the 1st comment:
Votes: 0
In Rom 2.4, and i'm pretty sure other Dikurivatives, it uses calloc to allocate space for the db. Now, i'm not sure that this is at all important, but i know that calloc allocates memory initialized to all bits 0.
Like i said, probably not too important for me at this point, but if someone knows why they used calloc instead of malloc it might help broaden my understanding of the codebase. :smile:
In Rom 2.4, and i'm pretty sure other Dikurivatives, it uses calloc to allocate space for the db. Now, i'm not sure that this is at all important, but i know that calloc allocates memory initialized to all bits 0.
Like i said, probably not too important for me at this point, but if someone knows why they used calloc instead of malloc it might help broaden my understanding of the codebase. :smile:
The entire reason to use calloc instead of malloc is so that it's initialized as zero. I'd say it was for syntax reasons (eg. calloc(2, sizeof(stuff) ) vs, malloc( 2 * sizeof(stuff) ) ) but really, there's very little difference.
20 Jul, 2009, David Haley wrote in the 4th comment:
Votes: 0
Sometimes you want things set to zero, so using calloc is an efficient way of doing that; other times you don't care as you will initialize it yourself, so you just use malloc.
Now, i'm not sure that this is at all important, but i know that calloc allocates memory initialized to all bits 0.
Like i said, probably not too important for me at this point, but if someone knows why they used calloc instead of malloc
it might help broaden my understanding of the codebase. :smile:
thanks.