470,596 Members | 1,594 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Re: vector::pop_back issue

On Jul 17, 10:27 am, Sarath <CSar...@gmail.comwrote:
at the time class destruction, application error occurs. Seems
the heap was corrupted with the pop_back operation on empty
vector.
the code failed to execute in Visual C++ 6 and 2008. but
worked fine in DevCPP. I admit that the pop function should
check for empty vector. but still the different behavior
concludes, it's a bug in Microsoft STL Implementation
Or rather, that you've undefined behavior in your code. Garbage
in, garbage out, as they say. (From a quality of implementation
point of view, of course, the code should crash, at least in
debug mode. Which is what all of my implementations -- Sun CC,
g++ and VC++ -- do, once I fix the errors which prevent it from
compiling.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jul 17 '08 #1
0 1044

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by James Brown | last post: by
2 posts views Thread by laniik | last post: by
5 posts views Thread by laniik | last post: by
10 posts views Thread by Bob | last post: by
3 posts views Thread by Jeff | last post: by
3 posts views Thread by Sarath | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.