|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Gdb debugging C + + program (standard procedure library vector) issue Relatively simple code as follows :
。。。。。。
Int main ()
{
Vector<string> vStr;
String's ( "allow tmp_t) (tmpfs_t tmpfs_t:filesystem associate") ;// 12th trip
VStr.push_back (s);
Cout<<vStr.at (0) "<endl;
Cout<<*vStr.begin () "<endl;
S.clear ();
Return 0
}
Able to operate normally, and the output is allow tmpfs_t:filesystem associate) (tmpfs_t tmp_t
But when debugging
(Gdb) break 12
Breakpoint 1 at 0x8048a8f test2.cpp : file, line 12.
(Gdb) r
Starting program : /home/dreamping/a.out
Breakpoint 1, main () at test2.cpp:12
's 12 string ( "allow tmp_t) (tmpfs_t tmpfs_t:filesystem associate");
(Gdb) n
13 vStr.push_back (s);
(Gdb) n
14 cout<<vStr.at (0) "<endl;
(Gdb) print vStr.at (0)
$ 1 = (string &) : {static0x804a7f8 npos = 4294967295.
_M_dataplus = = {<allocator<char>> Fields>} {<No data.
_M_p = 0x804a264 "allow tmpfs_t:filesystem associate -- tmpfs_t tmp_t)")
Static _S_empty_rep_storage = (0, 0, 0, 0}}
(Gdb) p *vStr.begin ()
$ 2 = (string &) : {static0xbffff98c npos = 4294967295.
_M_dataplus = = {<allocator<char>> Fields>} {<No data.
_M_p = 0xbffff98c "\001"), static _S_empty_rep_storage = (0, 0, 0,
0}}
Very strange and it is reasonable to say that the cases vStr.at (0) and *vStr.begin (), vStr.front () should be at the same ah
Static _S_empty_rep_storag
_M_dataplus
_M_p = 0xbffff98c
Debugging C + +, these unknown receivers Eastern mean,
Internet has not been found |
The popularity is also very good here, how no one to me?
About their Zaiding |
Or nobody Jimmy?
I Mt.
Ariadne want to have friends |
You did not look carefully at the code, but I ask a simple question, and STL is not to install any development kits ah. |
Cout<<vStr.at (0) "<endl;
Cout<<*vStr.begin () "<endl;
These two areas are the same value, there is nothing wrong with this, but it may be a temporary procedure to preserve their value indicator variables, you print out the values of those variables may be temporary guideline addresses.
PS : everyone has to work, busy :) |
Huntglede reply to the message, 4th Floor Installed themselves with the GCC. . . STL are a standard part of any sub-standard compiler must be provided, but may be different from the bottom of the achievement.
I see inside the Notes VC7.1
/[code]*
* Copyright (c) 1992-2002 by PJ Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */[/code]
PJ Plauger generation cattle people die :)
|
| |