認識一下 Inline function

忘記 inline function為什麼比較快,手上的入門書也沒說明,就google一下找到這篇說明 Inline Function 的文章,說得很清楚詳細。

筆記
  1. To eliminate the cost of calls to small functions, C++ proposes a new feature called inline function. An inline function is a function that is expanded in line when it is invoked. That is, the compiler replaces the function call with the corresponding function codes.
  2. We should take utmost care while making a function inline. The speed benefit of an inline function diminishes as it grows in size. At some point the overheads of the function call becomes small as compared to the execution of the function, and the benefits of inline function may be lost.
  3. There are few situations where an inline function may not work...


留言

這個網誌中的熱門文章

3dmax的biped如何使用CMU的免費motion capture資源

如何把3dmax的physique轉成skin

Flex 3 Tree 元件的資料更新Bug