Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is alloc.h?

Tags:

c

header-files

what is alloc.h? some questions on SO like this and this have included alloc.h.

but, when i tried to include it gcc gives error as error: alloc.h: No such file or directory

Has such file ever existed or those questions have included it just by mistake?

like image 317
user1526667 Avatar asked Aug 04 '12 10:08

user1526667


2 Answers

It's for dynamic memory allocation, but it isn't a ANSI C standard library. If you are using gcc then use stdlib for dynamic memory allocation:

#include <stdlib.h>

For some more information, have a look here.

If you read carefully the question you have linked, actually the problem was exactly trying to compile with gcc including that header. So don't use it.

like image 179
Heisenbug Avatar answered Oct 13 '22 17:10

Heisenbug


It's a header file that declares memory-management functions like malloc, free, realloc.

That header file is deprecated.

For C use

#include <stdlib.h>

For C++ use

#include <memory>
like image 40
YePhIcK Avatar answered Oct 13 '22 15:10

YePhIcK