看板 C_and_CPP 關於我們 聯絡資訊
※ 引述《[email protected] (1s軌域之逆旋水子)》之銘言: : ※ 引述《[email protected] (八方齋)》之銘言: : : 小弟用 C++ & Pthread lib在Linux上寫了一個multi-thread的程式, : : 發現若是將member function傳給pthread_create()當參數的話,將無法正確執行, : : 小弟覺得十分納悶,是compiler偷偷動了什麼手腳嗎?還是pthread有其專用的 : : C++ lib? : 問一下 member function 要如何決定 "this" 在哪裡? compiler會為member function增加一個參數, 也就是this指標, 而在object呼叫其member function時, 就傳入該object的address :) -- ※ 發信站: 批踢踢實業坊(ptt.twbbs.org) ◆ From: ccsun18.cc.ntu.edu.tw