Search code examples
linuxunixmallocrealloc

_recalloc in UNIX not found


Cant find _recalloc function in UNIX (not defined). Using headers:

#include <stdlib.h>
#include <malloc.h>

Where is it? Or how to implement?

UPDATE. There is no "recalloc" string in my "//usr/include/malloc.h" file. I wrote another function like this:

inline void* _recalloc(void* _Memory, _In_ size_t _Count, _In_ size_t _Size)
{
    return memset(_Memory + _Count, 0, sizeof(_Memory) * (_Size - _Count));
}

Is it correct?


Solution

  • Quoted::

    manpages will tell you where a function's definition comes from (ANSI C, POSIX, SysV, BSD, etc).

    The fact that malloc(), calloc(), realloc(), and free() are defined in <stdlib.h> while _recalloc() is defined in <malloc.h> is a clue that the latter is an IRIX-specific feature.