Bug in VC7? Or my mistake?

  • Thread starter Thread starter ckkwan
  • Start date Start date
C

ckkwan

The code below yield different results by just moving the _T("Phone")
to second line.

struct { TCHAR* ColName; CString& Value; } Columns[] =
{
{_T("Name"), m_Name}, {_T("Add1"), m_Add1},
{_T("Add2"), m_Add2}, {_T("Add3"), m_Add3},
{_T("Postcode"), m_Postcode}, {_T("State"), m_State},
{_T("Country"), m_Country}, {_T("Phone"), m_Phone},
{_T("MobilePhone"), m_MobilePhone}, {_T("Fax"), m_Fax},
{_T("IC"), m_IC}
};

Example:

struct { TCHAR* ColName; CString& Value; } Columns[] =
{
{_T("Name"), m_Name}, {_T("Add1"), m_Add1},
{_T("Add2"), m_Add2}, {_T("Add3"), m_Add3},
{_T("Postcode"), m_Postcode}, {_T("State"), m_State},
{_T("Country"), m_Country},
{_T("Phone"), m_Phone},
{_T("MobilePhone"), m_MobilePhone}, {_T("Fax"), m_Fax},
{_T("IC"), m_IC}
};

Regards
Kwna.
 
In the first case:

Columns[7].Value = _T("")

In the second case:

Columns[7].Value = _T("0123456789")

I am very sure there is no memory leak or corruption in the entire
application.
 
I don't see anything wrong. It's difficult to say where/what is the problem because I don't know the rest of your code...

--
Cholo Lennon
Bs.As.
ARG

<[email protected]> escribio en el mensaje In the first case:

Columns[7].Value = _T("")

In the second case:

Columns[7].Value = _T("0123456789")

I am very sure there is no memory leak or corruption in the entire
application.
 
In the first case:

Columns[7].Value = _T("")

In the second case:

Columns[7].Value = _T("0123456789")

I am very sure there is no memory leak or corruption in the entire
application.

Can you reliably replicate the problem by compiling and running it one
way, making that single change and compiling and running it again? Are
you seeing the problem only in the debugger, or if you print out the
value in logging code is the problem still present? Can you write a unit
test that replicates the problem?

Tom
 
In the first case:
Columns[7].Value = _T("")
In the second case:
Columns[7].Value = _T("0123456789")
I am very sure there is no memory leak or corruption in the entire
application.

Can you reliably replicate the problem by compiling and running it one
way, making that single change and compiling and running it again? Are
you seeing the problem only in the debugger, or if you print out the
value in logging code is the problem still present? Can you write a unit
test that replicates the problem?

Tom

Ok let me try again tomorrow. Certainly I did tried to remove the
changes and saw the problem reproduced before I ask here.

Anyway, not only Item #7 is having problem, all Items appear in the
second column are pointed to a null string pointing to a same address.
I only try in Debug mode, never try in Production before.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top