C Language: inline (GCC)

Source: Internet
Author: User

the http://blog.csdn.net/cxmanzhao/article/details/6801786 of inline function and non-inline function from the perspective of Assembly

Force inline and force not inline http://blog.csdn.net/hanchaoman/article/details/7270341

Inline-noinline http://blog.sina.com.cn/s/blog_61b5fb9c0100ud55.html

StaticInlineintFoointA//most of this function behaves like a normal static function, except that when calling this function, GCC expands its sink code to compile without generating a separateExchange code. In addition to the following situations: The address of the I function is used. If the function is indirectly called through a function pointer. In this case, you have to generate a separate sink encoding for the static inline function, otherwise it has no self->your own address. II Other situations that cannot be unfolded, such as the behavior of the function itself, which recursively calls itself. //extern inline int foo (int a)//a externinline function will only be inline, and will never generate a separate assembler code! The compiler does not generate a compilation for it, even if it is applied by a pointer or by a recursive call >Code//inline int foo (int a)//within the file in which it is defined, its performance is consistent with static inline: It is compiled inline when it can be expanded. But to be able to use it out of the file, GCC will definitely generate a unique >To make the call externally. {    return 1+A;}volatile intMainvoid){    inti =2; intA =0; intb =0; //Int (*PF) (int) = foo; //A = PF (i);b=foo (i); returnA +b;}~

C Language: inline (GCC)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.