When should I use __forceinline instead of inline?

前端 未结 12 1417
旧巷少年郎
旧巷少年郎 2021-01-01 09:34

Visual Studio includes support for __forceinline. The Microsoft Visual Studio 2005 documentation states:

The __forceinline keyword overrides the co

12条回答
  •  悲哀的现实
    2021-01-01 09:48

    There are several situations where the compiler is not able to determine categorically whether it is appropriate or beneficial to inline a function. Inlining may involve trade-off's that the compiler is unwilling to make, but you are (e.g,, code bloat).

    In general, modern compilers are actually pretty good at making this decision.

提交回复
热议问题