我有这样的枚举:
enum PROCESS_TYPE
{
PRI_PROC = 0,
BG_PROC = 64,
INT_PROC = 128,
TI_PROC = 256,
PHANTOM = 512,
BLOCK = 1024,
ZOOMBIE = 2048,
ILLEGAL = 4096
};
我有一个名为create_process
的函数,其中一个参数的类型为PROCESS_TYPE
,如下所示:
create_process(enum PROCESS_TYPE proc_type, const char *name, ...);
当我以这种方式使用create_process函数时:
create_process(BG_PROC, "server" ...);
我收到错误passing argument 1 of 'create_process' makes pointer from integer without a cast
。怎么解决这个?提前谢谢。
编辑:对于第二个参数,它是一个const char,但它也会报告错误passing argument 2 of 'create_process' makes pointer from integer without a cast
答案 0 :(得分:1)
您必须将功能调用更改为create_process(BG_PROC, "server");
而不是create_process(BG_PROC, "server" ...);
。对我来说,以下代码工作正常..
enum PROCESS_TYPE {
PRI_PROC = 0,
BG_PROC = 64,
INT_PROC = 128,
TI_PROC = 256,
PHANTOM = 512,
BLOCK = 1024,
ZOOMBIE = 2048,
ILLEGAL = 4096
};
void create_process(enum PROCESS_TYPE, const char *,...);
int main() {
create_process(BG_PROC, "server");
}
void create_process(enum PROCESS_TYPE proc_type, const char *name,...) {
// ...
}