Hi, Sorry - a typo in the class test definition. On Thu, 9 Aug 2007, Anitha Boyapati wrote: > > class test { public: test () { }; > }; > > void foo() { > test t; > } > > A part of the assembly listing is as follows for foo : > (I tried adding comments to each line) > > .align 2 > .globl _Z3foov > .type _Z3foov,@function > _Z3foov: > .LFB5: > pushl %ebp ; push ebp > .LCFI0: > movl %esp, %ebp ; ebp = esp > .LCFI1: > subl $8, %esp ; esp = esp - 8 (?) > .LCFI2: > subl $12, %esp ; esp = esp - 12 (??) > leal -1(%ebp), %eax > pushl %eax > .LCFI3: > call _ZN4testC1Ev > addl $16, %esp ; Why pop off 4 bytes ? > ... > > _ZN4testC1Ev: > .LFB6: > pushl %ebp > .LCFI4: > movl %esp, %ebp > ... > ret > > > As far as I know, arguments are pushed onto the stack before entering > a subroutine. Hence ebp makes sense. From here onwards, I feel lame. > Summarizing : > > 1. Why should subl $8 and sub $12 from esp happen ? > > 2. After the call to constructor, why are 16 bytes being poped > off? According to me, only 4 bytes ( for another round of ebp > in constructor) should be popped off. > > I could be missing some basic details which are what I am after. > Any help appreciated. > > Here is my version : gcc 3.2.3, host i386 redhat. > > -- Regards, Anitha B @S A N K H Y A