Question

Why does Erlang have a C NIF drop-in replacement for malloc, enif_alloc, but not calloc? Thereby forcing one to use memset() after enif_alloc for array access.

Was it helpful?

Solution

Well, I assume this has to do with the fact (from documentation):

"NIFs where introduced in R13B03 as an experimental feature."

On a side note, the Erlang review board is also quite conservative, probably due to the history of being born from a telelcom company, and that is understandable for fault tolerant languages.

I guess I don't see the problem you have since you are always welcome to write a proper port using calloc() and use the old marshaling methods. http://www.erlang.org/doc/tutorial/erl_interface.html

Happy C coding!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top