Ignored inline keyword
-
key word inline must be in h file. if u put inline in c/cpp files, it is ignored. inline means once. if only one c or cpp file includes the h file in a project, the key word inline may be ignored (upto compiler). if more than one c/cpp files include the h file, key word inline is NOT ignored.
A special image tool for Windows C++ programmers, don't miss it! A nice hyper tool for optimizing your Microsoft html-help contents. Includeh10
It seems you didn't get my question. I don't have any doubt in how to use inline. I know all the rules of inline. What i am asking is how to find the list of inline function(s) for which compiler has ignored the inline keyword?
-
It seems you didn't get my question. I don't have any doubt in how to use inline. I know all the rules of inline. What i am asking is how to find the list of inline function(s) for which compiler has ignored the inline keyword?
I don't know of any way of getting the compiler to tell you this. Steve
-
It seems you didn't get my question. I don't have any doubt in how to use inline. I know all the rules of inline. What i am asking is how to find the list of inline function(s) for which compiler has ignored the inline keyword?
I told you clearly: 1. if h file is included by 2 or more c/cpp files, inline is NOT ignored. 2. if only one c/cpp file includes the h file, all inline in the h file are ignored or not upto compiler - how do you want to know which inline is ignored? they are ignored all or none.
A special image tool for Windows C++ programmers, don't miss it! The world unique Software Label Maker is waiting for you and me ... A nice hyper tool for optimizing your Microsoft html-help contents.
-
key word inline must be in h file. if u put inline in c/cpp files, it is ignored. inline means once. if only one c or cpp file includes the h file in a project, the key word inline may be ignored (upto compiler). if more than one c/cpp files include the h file, key word inline is NOT ignored.
A special image tool for Windows C++ programmers, don't miss it! A nice hyper tool for optimizing your Microsoft html-help contents. Includeh10
includeh10 wrote:
key word inline must be in h file.if u put inline in c/cpp files, it is ignored.
Not necessarily. You can declare a static function in a .cpp file and mark it as inline and the compiler will inline it if it is small enough.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
In C++, inline keyword is a request to a compiler. Compiler can ignore it. Apart from poking through .asm files, is there any way to to find the list of inline function(s) for which compiler has ignored the inline keyword? May be some compiler setting(s) to generate the report containing this information. -- modified at 23:55 Thursday 30th March, 2006
Really, the only way you can do this is to get a list of the symbols in the program. If a function exists as a symbol in the executable, then it was not inlined. Of course, this involves enabling debug info, which usually disables inlining completely. Other than that, the ASM files are the way to go, although remember that the linker can inline functions (not only the compiler), so you may not find them all.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
I told you clearly: 1. if h file is included by 2 or more c/cpp files, inline is NOT ignored. 2. if only one c/cpp file includes the h file, all inline in the h file are ignored or not upto compiler - how do you want to know which inline is ignored? they are ignored all or none.
A special image tool for Windows C++ programmers, don't miss it! The world unique Software Label Maker is waiting for you and me ... A nice hyper tool for optimizing your Microsoft html-help contents.
It is not as simple as this - For example if you take the address of an inline function it is not inlined. There are many more complexities. Steve
-
Really, the only way you can do this is to get a list of the symbols in the program. If a function exists as a symbol in the executable, then it was not inlined. Of course, this involves enabling debug info, which usually disables inlining completely. Other than that, the ASM files are the way to go, although remember that the linker can inline functions (not only the compiler), so you may not find them all.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Ryan Binns wrote:
this involves enabling debug info, which usually disables inlining completely.
This is not the case: It is the "/Od" option which does this, this is distinct from the "/Zi" option (and friends) which controls the generation of debug info. I always have debug info enabled, even in release builds - It makes postmortem analysis of crash dumps easier. Steve
-
Ryan Binns wrote:
this involves enabling debug info, which usually disables inlining completely.
This is not the case: It is the "/Od" option which does this, this is distinct from the "/Zi" option (and friends) which controls the generation of debug info. I always have debug info enabled, even in release builds - It makes postmortem analysis of crash dumps easier. Steve
Thanks Ryan and Stephen. Yes using map files i can find the required information. But still this is manual and I need to manage the list of all inline functions. It will become cumbersome to maintain this list because we can define inline functions in header files without using inline keyword. I am looking for something that can automate this.
-
I told you clearly: 1. if h file is included by 2 or more c/cpp files, inline is NOT ignored. 2. if only one c/cpp file includes the h file, all inline in the h file are ignored or not upto compiler - how do you want to know which inline is ignored? they are ignored all or none.
A special image tool for Windows C++ programmers, don't miss it! The world unique Software Label Maker is waiting for you and me ... A nice hyper tool for optimizing your Microsoft html-help contents.
Kindly look at the another reply thread started by Ryan. Hope you would be able to understand my question.
-
Ryan Binns wrote:
this involves enabling debug info, which usually disables inlining completely.
This is not the case: It is the "/Od" option which does this, this is distinct from the "/Zi" option (and friends) which controls the generation of debug info. I always have debug info enabled, even in release builds - It makes postmortem analysis of crash dumps easier. Steve
Stephen Hewitt wrote:
This is not the case: It is the "/Od" option which does this, this is distinct from the "/Zi" option (and friends) which controls the generation of debug info.
Oops. I forgot we weren't using GCC :-O. If you specify -g to GCC to enable debugging, it also disables optimisations unless you specifically tell it to reenable then with a -O. You're right, of course :) I spend far to much time doing linux development :sigh:
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"