Built-in Features - Auto Built-in

When a short function is defined inside a class declaration, it automatically turns into a built-in function.

My questions:

  • How short should the feature for auto-lining be? Is there a limit for this?
  • Is there a way to find out that a function is automatically inserted in a line?
+4
source share
1 answer
  • How short should the feature for auto-lining be? Is there a limit for this?

There is no hard limit (more precisely, yes, we can find the upper limit for this system, but you will not find it anywhere). The compiler is trying to predict what the benefits of this process may be under certain circumstances. If the compiler decides that embedding the function will make the code slower or unacceptably large, it will not embed it. He will not do this if he simply cannot do it due to syntactic dependency, for example, other code, using the function pointer for callbacks, or exporting the function from the outside, as in a dynamic / static code library. Remember also that the inline marking function expresses only a wish; the compiler is not obliged to do this. In C, any function with an internal connection can be embedded, but a function with an external connection is subject to restrictions.

  1. Is there a way to find out that a function is automatically inserted in a line?

You can parse the binary and you will see if there is a function call or in a string .

Do built-in functions perform performance?

Built-in functions

+6
source

Source: https://habr.com/ru/post/1501537/


All Articles