[問題] sched.h ? [已解決]

看板C_and_CPP作者 (阿飄先生)時間13年前 (2011/06/09 12:56), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Linux gcc 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) <sched.h> 問題(Question): 最近在看 http://www.waterlike.com.tw/bookdata.asp?NO=TP3C107131 這本書 第七章關於 clone() 還是不太明白 於是就照著書上 code 7.2 在 vim 寫了一下小測試 首先,sleep() 是 <unistd.h> 裡的作者沒寫先不婊(誤 我的 gcc 說 warning: passing argument 4 of ‘clone’ makes pointer from integer without a cast /usr/include/bits/sched.h:83: note: expected ‘void *’ but argument is of type ‘int’ 查了一下 clone 的原型 int clone(int (*fn)(void *), void *child_stack, int flags, void *arg); 請問第一個參數的用法 程式碼(Code):(請善用置底文網頁, 記得排版) http://codepad.org/1HGNEFhV -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.60.107.233

06/09 13:02, , 1F
~"~他不是說錯在第四個參數嘛?.第一個參數應該放入函式
06/09 13:02, 1F

06/09 13:03, , 2F
那個是函式指標
06/09 13:03, 2F

06/09 13:03, , 3F
樓上一語驚醒夢中人!我知道了
06/09 13:03, 3F

06/09 13:05, , 4F
剛剛頭昏腦脹把NULL指標看成data...
06/09 13:05, 4F
文章代碼(AID): #1Dy5A0vm (C_and_CPP)