David Lowndes wrote:
Phil,
Can you give us a simple self-contained console application that will
compile and illustrate the differences you're experiencing?
Dave
I am working with MFC so here is an example in that
Drop this into the main 'view' cpp file of a new MFC application (just
before 'OnDraw'
- on the 64bit machine this compiles and runs straight past the
NULL->testMe() part
- on the 32bit machine - Unhandled exception which is what I would expect
I'd be really interested to know if this happens on other machines -
becuase it definately happens on my two.
Many thanks
Phil
// couple of very simple classes
class MTest
{
public:
float m_aVal;
float m_bVal;
MTest():m_aVal(0),m_bVal(0) {}
};
class RoomTest
{
public:
MTest *m_mat;
RoomTest():m_mat(NULL) {}
virtual MTest *getMaterial() {return m_mat;}
virtual void testMe()
{
MTest *tt=getMaterial();
tt->m_bVal=45;
tt->m_aVal=46;
}
};
void CcrashTestView::OnDraw(CDC* /*pDC*/)
{
CcrashTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// just create a real one
RoomTest testRoom;
// NULL pointer
RoomTest *room=NULL;
// call testMe on the NULL Pointer
room->testMe();
// TODO: add draw code for native data here
}