string confusion CPP
I have a class with a string member, lets say string Name;
I do Name="something"; in one method.
In the second method I do Name = "foo";
When I call the second method, the moment I press F10 on Name = "foo";
I see in the debugger that Name = {???} instead of the required string.
Why does this happen?
Thanks in advance.
The SC++L types might not be prettified by your debugger. Look at what's inside (including the internal character buffer, which should contain the correct value).
It also shows that npos is a very large number.
I didnt find anything that reminds the "foo" I assigned to Name.
I didnt find anything that reminds the "foo" I assigned to Name.
Do you have any sort of optimizations turned on? Optimizations can mess with the debugger quite a bit.
Quote:Original post by The C modest godRelatively speaking, std::string::npos is a very large number :)
It also shows that npos is a very large number.
Do you stop *at* Name = "foo", or do you go past it and still not see the name assigned. Also, which debugger are you using?
And string::npos is a static value that doesn't change throughout the life of the application. There is only one npos variable that is used to check for "not found" conditions in various string algorithms.
And string::npos is a static value that doesn't change throughout the life of the application. There is only one npos variable that is used to check for "not found" conditions in various string algorithms.
I use visual CPP 2003.
I don't use optimization and I go past the command.
To be more accurate, when I go past the Name = "foo"; command, the value showen is {???}.
I don't use optimization and I go past the command.
To be more accurate, when I go past the Name = "foo"; command, the value showen is {???}.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement