C + + inline functions

Source: Internet
Author: User

1, inline functions can be debugged, in the debug version does not realize true inline, release will be.

2. The function declaration and function Code of the inline function are placed in the symbol table (where the compiler collects and holds literal constants and certain symbolic constants), the compiler checks the function for type safety, and if correct replaces the calling statement, omitting the cost of the function call.

3. Assert is a macro that the debug version takes effect, not an inline function.

4, inline mechanism with macro efficiency, code security, the amount can be free to manipulate the data members of the class (this address is placed in the appropriate place, the macro cannot be done in preprocessing).

5. Inline functions and function body definitions are put together, and function declarations do not work (general function declarations do not add inline).

6. member functions in a class declaration are automatically converted into inline functions. (Constructors and destructors may call functions of the base class, so they cannot be easily converted to inline functions).

7, inline easily make code expansion too large, the function body has a loop or complex control structure, the execution function body code time to function calls more.

8, the compiler will optimize the inline function, automatically cancel the inline.

C + + inline functions

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.