關於__fastcall 的問題? |
尚未結案
|
cliffpen
一般會員 ![]() ![]() 發表:35 回覆:18 積分:15 註冊:2005-05-16 發送簡訊給我 |
BCB裡面內建的function前面都會加上__fastcall這個指令
查了BCB裡面,節錄出以下結果
Use the __fastcall modifier to declare functions that expect parameters to be passed in registers. The first three parameters are passed (from left to right) in EAX, EDX, and ECX, if they fit in the register. The registers are not used if the parameter is a floating-point or struct type. All form class member functions must use the __fastcall convention.
請問各位大大,是不是說所有的function前面加上__fastcall會讓處理的速度變快,會有不好的影響嗎?
|
暗黑破壞神
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
pwipwi
版主 ![]() ![]() ![]() ![]() ![]() 發表:68 回覆:629 積分:349 註冊:2004-04-08 發送簡訊給我 |
|
暗黑破壞神
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
其實。追起源由。
有兩個方法會比較快。
一個是利用暫存器來加快。
另一個是 C 的參數允許不定個數。
而 pascal 不允許。
所以在傳參數時。 C 的傳送法會比較慢。
因為是利用 stack, push, push, pop, pop 的方法。
而 pascal 就不必考慮不定數。
所以不必那樣處理。所以在傳參數上會比較快。
所以。當年如果要加快那一點點。就要在函數前寫上 pascal (ps. 正確寫法我也已經忘記了)
這樣來讓 compiler 會以 pascal 的參數傳遞方式來編 bin code.
而會用 fastcall 我是覺得因為 c builder 一直是 delphi 的影子。
而產生的一種表達方式吧。^_^
|
tomex.ou
一般會員 ![]() ![]() 發表:8 回覆:54 積分:22 註冊:2005-05-05 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |