最近在做代码移植的工作,涉及到内存分配的问题,源代码里使用了alloc如下
#define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
源代码是这样定义alloc的:
#ifdef __GNUC__ #undef alloca #define alloca __builtin_alloca #elif defined WIN32 || defined WIN64 #if defined _MSC_VER || defined __BORLANDC__ #include <malloc.h> #endif #elif defined HAVE_ALLOCA_H #include <alloca.h> #elif defined HAVE_ALLOCA #include <stdlib.h> #elif #error #endif
请问如果是dsp的话,要怎么来定义alloc以分配内存?