c ++ inline member functions issues (reprint)

Author: Blue
Links: https://www.zhihu.com/question/29809743/answer/45701907
Source: know almost

First inline is achieved modifier , rather than a statement modifier, the modified section should be used to achieve (you can also be placed inline in a statement, but not necessary), I believe C ++ Primer should be explained very clearly.

So why can not function declaration screen.h move, screen.cpp move to achieve it? Because the inline code is directly inserted to expand into place is called, rather than as an ordinary function call, like the stack operation needs to happen. That will go to execute the called function, turn back to continue the calling function. Well, this time, you're either in main.cpp also the same as x.cpp once again inline achieve this function, or you could just only in the class body inside xh realize, of course, if you're like me have "the code over the top" words , which may be the same as the first in the class declaration like me, then realized outside the class body: LLVMPascalCompiler / scanner.h aT Master · FrozenGene / LLVMPascalCompiler · GitHub

In fact, I now feel very sad to inline the compiler has evolved to such an extent, and I think it is entirely possible to the compiler to decide for themselves whether inline (because even if you gave inline, just to the compiler reminders can be inline, Finally, the compiler inline or not still needs to decide), and perhaps one day will be inline keyword and register as exit stage right.

Guess you like

Origin www.cnblogs.com/jixiaohua/p/12563458.html