Re: strang behaviour std:vector and XString in VC6.0
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 11/12/04
- Next message: Philippa Cowderoy: "Re: C++ sucks for games"
- Previous message: Gerry Quinn: "Re: C++ sucks for games"
- In reply to: Stijn Oude Brunink: "strang behaviour std:vector and XString in VC6.0"
- Next in thread: Ron Natalie: "Re: strang behaviour std:vector and XString in VC6.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 12 Nov 2004 12:41:39 -0000
"Stijn Oude Brunink" <soudebrunink@chello.nl> wrote in message
news:3Q1ld.1069$_u6.17@amsnews02.chello.com...
> Hello
>
> I'm using std:vector to hold some pointers
>
> vector<CBase*> x;
>
> In the debug version I've the following problem:
> After I've added a couple of pointers using the push_back function and I
> iterate over x the program crashes in the iteration loop. If I debug the
> program I see that the Iterator has som strange value which I did not put
> in. Finially I end up in the XString header where there seems to be some
> kind of memory allocation problem. If I ask for the last pointer in x
using
> x.back() I get a good result. but x[x.size()-1] produces nonsense;
>
You have a bug in your program. I can promise you that it is not in the
single line of code you have posted, but in one of the many lines of code
you didn't post.
> The problem stated does not occur in release mode.
That is not unusual, in fact it is typical. One possibility is that you have
an uninitialised variable which happens to get one value in debug mode and a
different value in release mode.
>
> Does anaybody know what is going on.
>
You have a bug in your code.
> I use VC6.0.
>
It has a very good debugger, use it. Alternatively post the code.
john
- Next message: Philippa Cowderoy: "Re: C++ sucks for games"
- Previous message: Gerry Quinn: "Re: C++ sucks for games"
- In reply to: Stijn Oude Brunink: "strang behaviour std:vector and XString in VC6.0"
- Next in thread: Ron Natalie: "Re: strang behaviour std:vector and XString in VC6.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|