Found out what was going on. (for any who follow with the same problem).

The code was used in subclasses and was out of alignment. Watch out for the following.
class bar;
class foo
{
char ALetter;
bar *SomeClassPointer;
};

At the time of the assignment SomeClassPointer will be at an odd address location. The only way I could find of tracking these down, is to use the debugger and look at the stack and the variables. The one giving you problems will be at the bottom with an odd address. As you move up the list you will eventually find one that is at an even address. (In the above example it would be "ALetter"); Stick another char after it in order to even things out.

#pragma align 2

Makes no difference.

Chris Bruner
Compulife Software Inc.
==============================================
----- Original Message ----- From: "cbruner" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Thursday, October 06, 2005 1:33 AM
Subject: odd memory write problem


The code is pretty simple. clstring just grabs some memory using new.This routine is called 3 times, and on the third time I get an error that I'm writting to an odd address in memory. (see /// error here below). I have no idea where this could be coming from. The code doesn't change between calls. How do people go about debugging this type of problem?



class filebase
{

FileRef Handle;
# define FILENOTOPEN 0
static UInt16 volRefNum;
bool FindVolRefNum();
bool CheckVolRefNum() const;

int RW;
protected:
clstring *PathName;
public:
filebase()
{
clstring *dummy;
   dummy = new clstring("");
   PathName = dummy;            /// error here!
   Handle = FILENOTOPEN;
}



Chris Bruner
Compulife Software Inc.
==============================================

--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/




--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to