Automatic Zero Set. What happens, when memory is cleared (ie. set to zero) upon allocating.

This is one of the nasty things that makes programmer's lifes miserable as you sometimes forget that AZS is not necessarily happening but is usually only present in debug mode (in high level - and hardly ever in ASM).

(I will now talk in MSVC++ terms - feel free to kill me). When programming, you often check a pointer for being NULL - meaning that no memory is allocated. So you might have a cute little int pointer called *m_pData in some C++ class. Then in the destructor, having:
CDataHandling::~CDataHandling()
{
	if(m_pData) delete m_pData;
}
And this will work absolutely perfect in debug mode - where all the debug assertions will even guide you through the rough process of finding your stupid mistakes.

When entering the release version, the program will simply crash, if you for some reason didn't allocate any data in your m_pData AND your constructor doesn't contain:
CDataHandling::CDataHandling()
{
	m_pData=NULL;
}

Have I ever done this? Of course not - I'm a trained professional... (Ahem...)

Log in or registerto write something here or to contact authors.