Hi,
I wanted to know what is the difference between these two
initialisation of Rogue Wave STL string. Are they different. Because
when I generated the assembly code for this I found that test.c
generated a piece of code that was not generated by TEST1.c.
TEST.c
#include <string>
#include <iostream>
using namespace std;
int main()
{
string st;
st="";
return 0;
}
TEST1.c
#include <string>
#include <iostream>
using namespace std;
int main()
{
string st("");
return 0;
}
Piece of assemly code generated by test.c. Can you just also tell me
what the below code is doing.
.type __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mrkn0C__v_,2
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mrkn0C__v_:
save %sp,-200,%sp
st %i1,[%fp+72]
st %i0,[%fp+68]
! block 1
.L87:
.L88:
! File /opt/forte6.2.patched.2/SUNWspro/WS6U2/include/CC/Cstd/./string:
ld [%fp+68],%i4
st %g0,[%fp-8]
add %fp,-8,%o1
st %o1,[%fp-96]
ld [%fp+72],%i5
st %i4,[%fp-84]
st %i5,[%fp-88]
ld [%o1+0],%o0
st %o0,[%i4+0]
ld [%fp+68],%i3
sethi %hi(__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_),%o2
or %o2,%lo(__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___J__nullref_),%o2
st %o2,[%fp-12]
st %o2,[%fp-20]
add %o2,40,%o0
st %o0,[%fp-16]
add %fp,-16,%o0
st %o0,[%fp-44]
ld [%o0+0],%o0
st %o0,[%i3+0]
st %i3,[%fp-32]
add %fp,-36,%o0
st %o0,[%fp-24]
st %i3,[%fp-28]
ld [%i3+0],%o0
st %o0,[%fp-36]
st %o2,[%fp-48]
st %o2,[%fp-80]
cmp %o2,%o2
be .L91
st %o2,[%fp-52]
! block 2
.L90:
st %o2,[%fp-60]
st %o2,[%fp-68]
st %o2,[%fp-56]
add %o2,24,%o1
ld [%o1+0],%o0
add %o0,1,%o0
st %o0,[%o1+0]
ba .L92
st %o2,[%fp-64]
! block 3
.L91:
.L92:
jmp %i7+8
restore
! block 4
.L89:
jmp %i7+8
restore
Thank you
Nitin |