Do inline functions have addresses?

后端 未结 6 1710
情深已故
情深已故 2020-12-14 19:05

In section 7.1.1 of the book \"The C++ Programming Language\" the author states:

\"inline function still has a unique address and so do the static variables of an in

6条回答
  •  情话喂你
    2020-12-14 19:46

    I think you are confusing the location of the inlined functions object code, with the implications of inlining. Typically we visualize inlined functions as being placed within the calling function at the source code level. What the book is saying is that the variable names, including the use of static within inline functions, are treated just the same as if the function was in fact your typical, stand-alone function.

    Furthermore, treatment of functions with the inline keyword, does not guarantee that they will be inlined, and for instances where they cannot (such as when requiring an address), a non-inlined version will be generated.

提交回复
热议问题