User: Password:
|
|
Subscribe / Log in / New account

calloc()

calloc()

Posted Aug 11, 2005 19:32 UTC (Thu) by brettlevin (guest, #29117)
Parent article: kzalloc()

Does anyone know the story behind the count parameter in libc's calloc()?


(Log in to post comments)

calloc()

Posted Aug 11, 2005 22:17 UTC (Thu) by brettlevin (guest, #29117) [Link]

I found a libc guru to ask.

In 4.1BSD the args to malloc and calloc were unsigned ints. There were at least some machines who had 16-bit ints, but which had more than 2^16 worth of addressable memory. In such an environment it might be useful to allocate more than 64Kb in one call.

Then POSIX changed these args to size_t, easing the size restriction.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds