c - Why calloc wasn't intended to assign arbitrary values? -
as per why malloc+memset slower calloc?
malloc
+memset
slower calloc
under conditions.
why wasn't calloc
written in such way can take value
argument ( memset
) override default assignment zero? have been effect of if done?
these calloc
or memset
initializations operate on byte level, memset
value different 0
not usefull. @ least don't remember having used different values. allocate memory base type wider char
.
the other aspect calloc
initialization , not assignment. platforms may have builtins provide fast initialization of bytes 0
, wouldn't capture when passing argument initialize.
but important aspect history of c. these interfaces originate beginning , impossible change.
Comments
Post a Comment