What is alloc.h?

What is alloc.h ? some questions about SO, such as this and, included alloc.h .

but when I tried to enable it, gcc gives an error like error: alloc.h: No such file or directory

Was such a file ever existed or did these questions include it by mistake?

+7
source share
2 answers

This is a header file that declares memory management functions like malloc , free , realloc .

This header file is deprecated, use #include <memory> instead

+5
source

This is for dynamic memory allocation, but it is not the standard ANSI C library. If you use gcc, use stdlib to allocate dynamic memory:

 #include <stdlib.h> 

For more information, see here .

If you carefully read the question you linked, in fact the problem was precisely what you were trying to compile gcc, including this header. Therefore, do not use it.

+7
source

All Articles