warning: missing sentinel in function call

warning: missing sentinel in function call


因為NULL不是一個正確的字元結束( terminated )資料型態,所以就會產生warning: missing sentinel in function call

#include

int main() {
execl("/bin/ls", "ls", "-l", NULL);
return 0;
}

為了要避險這樣的情形產生。

#include

int main() {
execl("/bin/ls", "ls", "-l", (char *)NULL);
return 0;
}
這樣gcc就不會產生
warning: missing sentinel in function call

轉載:
http://ericforyou.blogspot.com/2009_02_01_archive.html

留言

這個網誌中的熱門文章

NMEA標準格式 -- GPS

網路 Transformer 的用途