inline-code

C++'s “inline” - how strong a hint is it for GCC and Clang/LLVM?

拈花ヽ惹草 提交于 2019-11-28 02:44:33
问题 In C++, the keyword "inline" serves two purposes. First, it allows a definition to appear in multiple translation units. Second, it's a hint to the compiler that a function should be inlined in the compiled code. My question: in code generated by GCC and Clang/LLVM, does the keyword "inline" have any bearing on whether a function is inlined? If yes, in what situations? Or is the hint completely ignored? Note this is a not a language question, it is a compiler-specific question. 回答1: [Caveat:

Are there inline functions in java?

心不动则不痛 提交于 2019-11-26 05:22:18
问题 Is there a concept of inline functions in java, or its replaced something else? If there is, how is it used? I\'ve heard that public , static and final methods are the inline functions. Can we create our own inline function? 回答1: In Java, the optimizations are usually done at the JVM level. At runtime, the JVM perform some "complicated" analysis to determine which methods to inline. It can be aggressive in inlining, and the Hotspot JVM actually can inline non-final methods. The java compilers