Question regarding c++ constructors

Mike Stump mrs@apple.com
Tue Mar 1 19:42:00 GMT 2005


On Feb 21, 2005, at 3:45 AM, Mile Davidovic wrote:
> Functions are completely the same.
> What is the reason for such compilere behaviour?

Just lack of code in the compiler to do better, see 
http://gcc.gnu.org/ml/gcc-patches/2002-08/msg00354.html for some of the 
details and starting point, should you want to develop the code 
further....  With that compiler, one can get:

__ZN4testC2Ev:
LFB4:
         b __ZN4testC4Ev
LFE4:
         .align 2
         .globl __ZN4testC1Ev
.section __TEXT,__text,regular,pure_instructions
         .align 2
__ZN4testC1Ev:
LFB6:
         b __ZN4testC4Ev
LFE6:
         .align 2
         .globl __ZN4testC4Ev
.section __TEXT,__text,regular,pure_instructions
         .align 2
__ZN4testC4Ev:
LFB7:
         blr
LFE7:

While this case doesn't show it, imagine if the code were long to very 
long, the savings increase.




More information about the Gcc mailing list