Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This mimics C++ vector, e.g.:

    vector<int> vec(5);
    vec.push_back(11);
    vec.push_back(12);
Now you have in vec:

    0, 0, 0, 0, 0, 11, 12
But your suggestion is better from an API point of view.


PS please note that there is no memset nor any other mean to zero initialize the elements. So the code appears to have a bug anyway.


Correct, this is a bug. calloc will better mimic the way C++ std::vector works.


Oh... thanks! I was not aware.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: