当前位置: 技术问答>linux和unix
这里的类型都是指针啊怎么会出现warning: assignment makes pointer from integer without a cast
来源: 互联网 发布时间:2016-09-27
本文导语: #define UTMPNULL (struct utmp *)NULL struct utmp *utmpNext() { struct utmp *next; if(curRec == numRec && utmpReload() == 0) return UTMPNULL; next = (struct utmp *)utmpBuf; curRec++; return next; } while((buf ...
#define UTMPNULL (struct utmp *)NULL
struct utmp *utmpNext()
{
struct utmp *next;
if(curRec == numRec && utmpReload() == 0)
return UTMPNULL;
next = (struct utmp *)utmpBuf;
curRec++;
return next;
}
while((buf = utmpNext()) != UTMPNULL) //warning: assignment makes pointer from integer without a cast
|
如果用gcc -Wall来编译,应该有警告的。
如果在调用utmpNext函数之前没有他的定义或声明,编译器会默认的把它当成返回int
如果在调用utmpNext函数之前没有他的定义或声明,编译器会默认的把它当成返回int