⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memalloc.h

📁 贝叶斯优化算法是一种新的演化算法
💻 H
字号:
#ifndef _memalloc_h_
#define _memalloc_h_

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

// inline functions

inline void *Malloc(int x)
{
   void *p;

   p=malloc(x);

   if (p==NULL)
   {
      printf("ERROR: Not enough memory (for a block of size %u)\n",x);
      exit(-1);
   }

   return p;
}

inline void *Calloc(int x, int s)
{
   void *p;

   ///   printf("Allocating %u blocks of length %u\n",x,s);

   p=calloc(x,s);

   if (p==NULL)
   {
      printf("ERROR: Not enough memory. (for a block of size %u)\n",x*s);
      exit(-1);
   }

///   cout << "Allocated..." << flush

   return p;
}

inline void Free(void *x)
{
  free(x);
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -