- Dec 24, 2004
- 2,583
- 0
- 0
//FILE1.cpp:
extern"C" void foo()
{
//some code
}
//FILE2:
__forceinline void bar()
{
foo();
}
Does foo exist in only one memory location, or is there a copy of it wherever there is bar?
Thanks!
//FILE1.cpp:
extern"C" void foo()
{
//some code
}
//FILE2:
__forceinline void bar()
{
foo();
}
Originally posted by: nickbits
foo() will not be made inline in bar()
Originally posted by: Cogman
Originally posted by: nickbits
foo() will not be made inline in bar()
Rather, it won't be forced to be inlined with bar. If foo is simple enough many compilers will automatically inline simple functions as an optimization.
Originally posted by: degibson
Originally posted by: Cogman
Originally posted by: nickbits
foo() will not be made inline in bar()
Rather, it won't be forced to be inlined with bar. If foo is simple enough many compilers will automatically inline simple functions as an optimization.
Not if the functions are in different files, as suggested by the comments.
Originally posted by: Venix
Visual C++ can. Visual Studio 2005 and later have "Whole Program Optimization," which can inline functions that are defined in different compilation units.
