Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7954 Discussions

Choice between 'extern inline' and macros

aniruddhas
Beginner
478 Views
I want to know how the Intel C compiler handles the use of 'extern inline'. I intend to use either 'extern inline' or macros on a Linux P4 Xeon processor system and am using -O2 level of optimization. How do I confirm whether or not the Intel C compiler has actual expanded an inline function? Given that I want to avoid the overhead of making a function call, would you recommend using 'extern inline' or macros? Please let me know if my question is clear or more information is needed.


Thanks,
Aniruddha
0 Kudos
2 Replies
rmauldin
Beginner
478 Views

Well, one can always be sure that a macro is expanded. Why not use the inline code as a macro. If it is possible to get away with using just macros without inline assembly, it may even be further optimized by the compiler on a separate pass, while extern inline code may not. Even try both using macros and extern inline functions and see which one is faster, if time is permitted. Also, for portability if the code is good enough that other people may want to use it, just stick with C++ code and macros so that it can be compiled and used on other architectures as well. If one is an expert assembly writer, they would have enough code to want to make an inline assembly function call. And if the code being used is making the extern inline call, isnt the routine already compiled, and would not be expanded. Then again obviously I see your problem. I do not know the proper optimization levels to use to get these function calls to be used as extern inline expanded code. Interesting problem,
Ryan Mauldin

Message Edited by rmauldin on 10-17-2005 02:30 PM

0 Kudos
rmauldin
Beginner
478 Views
A little Re-cap and i was thinking... assembly calls are either extern or inline.. didn't think they could be both.
0 Kudos
Reply