Search This Blog

Monday, January 3, 2011

If I say calloc(1000, 23), does the 23 "round up" to 24? Or to 32?

Programmer Question

Hi,



I was wondering, do most implementations of calloc treat the size as an alignment too, and round it up to the next supported granularity?



If so, then do they round up to the next power of 2, or do they round to the next multiple of 8 or 16?



If calloc keeps the parameter the same, then how does that even work? Wouldn't your data then be unaligned?



Thank you!



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails