Re: Templates and Non-Inline Functions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Do you know of any references that discuss the size of a function being used
by Visual C++ to determine whether or not the function will be inline or
not?

Thanks.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

"Bo Persson" <bop@xxxxxx> wrote in message
news:475q5iFdsg1tU1@xxxxxxxxxxxxxxxxx

"AliR" <AliR@xxxxxxxxxxxxx> skrev i meddelandet
news:440daf5c$0$28685$a8266bb1@xxxxxxxxxxxxxxxxxxxxxx
Yes you did. SomethingElse is not marked as inline and the body is not
within the class definition, so it's not going to be inlined.

Unless, of course, the compiler thinks it is a good idea to do that
anyway. :-)

If the function really is just a "return somethingelse", the compiler
might inline it however you define it.

Also, even if you specifically ask for a function to be inlined, the
compiler isn't required to obey. Sometimes it's not possible anyway.


The safest way to avoid inlining is to make the function too big.


Bo Persson




.



Relevant Pages

  • Re: calloc.... Why?
    ... >> And using references doesn't make the optimizer's job any ... >and registers), but when the function's inline, the stack ... The compiler can choose to inline ... int foo = 10; ...
    (comp.lang.cpp)
  • Re: RAD Studio Roadmap Updated
    ... Strict private and strict protected provide a means for the compiler ... It will comply according to the specification (of the inline ... the exposure of the implementation details is CRITICAL ...
    (borland.public.delphi.non-technical)
  • Re: OT: C++ overloading operators
    ... way before complex numbers were part of the STL. ... I used the INLINE directive for these trivial functions. ... A compiler can not do inlining without access to the source code. ...
    (comp.dsp)
  • Re: HLA
    ... inline assembler for that compiler. ... different beast from a standalone assembler and IMHO, HLA is most ... It could be added to almost any C compiler without problems... ... then you're no longer programming in the standard form of the ...
    (alt.lang.asm)
  • Re: Inline Functions?
    ... an inline function is a programming language ... that is, it suggests that the compiler ... so the complete body of function func() should actually be placed from ...
    (comp.lang.c)