473,385 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1223

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: James Brown | last post by:
Hi, I am using the std::vector class as follows: vector <myclass *> stack1; and am pushing myclass objects onto the end of the vector like so: myclass *ptr = new myclass();...
2
by: laniik | last post by:
Hi. For some reason I am getting a crash on pop_back() and Im not sure why. sorry I cant post the whole code because the vector is used in a bunch of places. i have a vector<bool> complete;
10
by: gogogo_1001 | last post by:
Dear all, I don't understand why "delete" works well on destructing a object, but fails to destruct a vector of it. Any of your comment is highly appreciated! Following is the program...
2
by: Andy | last post by:
Hi, I did not find documentation on this. I try the following naive program, #include <vector> #include <iostream> using namespace std;
5
by: laniik | last post by:
Hi. I have a STL vector of some relativly complicated objects I was wondering if there was a good way to remove objects from the middle of the vector. Currently the only way I know how to...
10
by: Bob | last post by:
Here's what I have: void miniVector<T>::insertOrder(miniVector<T>& v,const T& item) { int i, j; T target; vSize += 1; T newVector; newVector=new T;
3
by: Jeff | last post by:
I have a question about potential memory leakage in a 2 dim array I have. If I say: vector< vector<int> > vec; vec.push_back( vector<int>() ); // initialize the row vec.push_back(1);...
3
by: Ramon F Herrera | last post by:
Newbie alert: I come from C programming, so I still have that frame of mind, but I am trying to "Think in C++". In C this problem would be solved using unions. Hello: Please consider the...
3
by: Sarath | last post by:
Dear All, 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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.