Can C ++ 11-compilers always always ignore inline hints?

Reading the old answer in When should I write the keyword 'inline' for a function / method? which reads:

They say that the built-in hints to the compiler that you think the function should be built-in. That might be true in 1998, but a decade later the compiler doesn't need such hints. Not to mention that people usually make mistakes when it comes to code optimization, so most compilers completely ignore the "hint".

This answer was published in 2009, so I want it to finally understand:

  • inlineDo modern C ++ 11-compatible compilers always ignore user- supplied hints and only do this automatically?
  • Tips inlineare only for backward compatibility?
  • If not 1., then this answer is incorrect?
+4
source share
3 answers
  • Modern C ++ 11-compatible compilers always ignore the built-in hints given by the user and do this only automatically?

C ++ 11 does not matter here, the C ++ 11 standard has not changed the semantics inline, and compiler optimization is largely independent of the compiled language version.

  1. ?

, inline , "" inline, , . , inline, , , , . .

, ( Link-Time Optimization , LTO , LTO, link-time inlining).

inline " , " ".

, inline , , , . , , .

, , , inline , ( ).

, , 2009 .

+3
  • , , ( MSVC inline, GCC 5.1.0 inline ).
  • , , .

inline , , . , /// , , , , inline .

, , , , , static.

, GCC 4.7.2 (, , , ), , inline , . , , , , , , . , "" , , .

+6

++ 11 , ++ 03 .

, inline . __attribute__((always_inline)).

inline ( , ) , , (.cpp ). , , , , inline .

+2

All Articles