Reputation: 65046
If link-time code generation (LTCG) is being used with MSVC, is it possible that code can be optimized across the C and C++ language boundary?
For example, can a C function be inlined into a C++ caller?
Upvotes: 3
Views: 89
Reputation: 15172
Yes, I just tried it with:
int foo() { return 5; }
in a .c file and:
extern "C" int foo();
printf("%d\r\n", foo());
in a .cpp the disassembly is:
00007FF60F6F3935 mov edx,5
00007FF60F6F393A lea rcx,[string "%d" (07FF60F727FB4h)]
00007FF60F6F3941 call printf (07FF60F701E00h)
Upvotes: 3