inline specifier
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
[編集] 構文
inline function_declaration | |||||||||
[編集] 説明
inlineキーワードは、最適化を実行するために、コンパイラに与えられたヒントです。コンパイラは、この要求を無視する自由を持っている.
Original:
The inline keyword is a hint given to the compiler to perform an optimization. The compiler has the freedom to ignore this request.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
コンパイラが関数をインライン化した場合、それは実際のボディ(コールを生成せず)と、その関数のすべての呼び出しを置き換え.
Original:
If the compiler inlines the function, it replaces every call of that function with the actual body (without generating a call).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
これは、関数呼び出し(スタック上にデータを配置し、結果を取得する)によって作成された余分なオーバーヘッドを回避できますが、関数のコードが複数回繰り返されなければならないとして、それは大きな実行可能になることがあり.
Original:
This avoids extra overhead created by the function call (placing data on stack and retrieving the result) but it may result in a larger executable as the code for the function has to be repeated multiple times.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
結果は関数形式のマクロに似ています
Original:
The result is similar to 関数形式のマクロ
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
関数本体は、現行の翻訳単位で表示されている必要があり.
Original:
The function body must be visible in the current translation unit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
クラス本体の内部で定義されたクラスのメソッドが暗黙的にインラインで宣言されています.
Original:
Class methods defined inside the class body are implicitly declared inline.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
このコードを実行します
inline int sum(int a, int b) { return (a + b); } int c = sum(1, 4); // if the compiler inlines the function the compiled code will be the same as writing int c = 1 + 4;