Question
I know VC6 is 20th century technology, but for some special reasons that's the compiler I have to use.
I have the following code, which works just fine in Visual Studio Express 2008 (32 bits)
while( sqlite3_step( stmt ) == SQLITE_ROW ) {
int tmp;
tmp = sqlite3_column_int64( stmt, 0 );
if(DEBUG) { cout << "KeyID - " << tmp << endl ; };
keyIDs.push_back(tmp);
if(DEBUG) { cout << "Size keyIDs - " << keyIDs.size() << endl ; };
}
In this particular test case, there's only one record, so the output, as you might expect, is
KeyID - 1
Size keyIDs - 1
However, if I compile the whole stuff (included sqlite3) with VC6 (32 bits), I have the following result:
KeyID - 1
Size keyIDs - 0
keyIDs is defined as
vector<sqlite3_int64> keyIDs;
but we even tried changing it to
vector<int> keyIDs;
I'm running out of ideas on what can be wrong, so I accept even wild guesses?
EDIT:
We solved this problem by using a local vector (keyIDs is a class member). Somehow, some piece of code elsewhere that I don't feel like tracking was (possibly) corrupting the vector, rendering it useless. Why this is happening only with VC6? That will remain a mystery.
EDIT2:
Although I haven't got to the root cause, I did find another problem (in a different proyect) with a large string (2800+ chars) passed to a function. The function itself received something like
function("something"+largestring+"anotherstring")
and this caused a memory exception elsewhere (coincidently, with a vector). It was solved by doing
largestring = "something";
largestring += stuff;
largestring += "anotherstring";
function (largestring);
In conclussion, it seems that something is wrong when VC6 creates a large object in the heap, and this may corrupt memory.
I hope this helps someone who, like me, is stuck with VC6 and is finding obscure errors.
No correct solution