G
Guest
Please take a look at the simple console app code below:
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
typedef struct {
unsigned long checkSum;
} DATALOG_FILE;
class CLogConfig
{
public:
CLogConfig();
~CLogConfig();
public:
DATALOG_FILE log [16];
};
CLogConfig::CLogConfig()
{
}
CLogConfig::~CLogConfig()
{
}
int _tmain()
{
CLogConfig m_LogConfig;
m_LogConfig.log[0].checkSum = 123 ;
m_LogConfig.log[5].checkSum = 456 ;
m_LogConfig.log[9].checkSum = 789 ;
return 0;
}
I set breakpoint at the beginning of main procedure, run this program in
VS.NET 2003 debugger and debug it step by step. I add
m_LogConfig.log[0].checkSum
values to watch window and observe the following:
The first statement works fine and value 123 assigned to
m_LogConfig.log[0].checkSum
However the second and third statement due to unknown reasons do not assign
values 456 and 789.
Even when I open QuickWatch window and try to change value of variable
m_LogConfig.log[5].checkSum the error dialog "Cannot Change Value" pops up.
Can anyone explain what is going wrong with this code?
Thank you
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
typedef struct {
unsigned long checkSum;
} DATALOG_FILE;
class CLogConfig
{
public:
CLogConfig();
~CLogConfig();
public:
DATALOG_FILE log [16];
};
CLogConfig::CLogConfig()
{
}
CLogConfig::~CLogConfig()
{
}
int _tmain()
{
CLogConfig m_LogConfig;
m_LogConfig.log[0].checkSum = 123 ;
m_LogConfig.log[5].checkSum = 456 ;
m_LogConfig.log[9].checkSum = 789 ;
return 0;
}
I set breakpoint at the beginning of main procedure, run this program in
VS.NET 2003 debugger and debug it step by step. I add
m_LogConfig.log[0].checkSum
values to watch window and observe the following:
The first statement works fine and value 123 assigned to
m_LogConfig.log[0].checkSum
However the second and third statement due to unknown reasons do not assign
values 456 and 789.
Even when I open QuickWatch window and try to change value of variable
m_LogConfig.log[5].checkSum the error dialog "Cannot Change Value" pops up.
Can anyone explain what is going wrong with this code?
Thank you