Hi
I wondered if it's possible to check if a pointer have gotten memory allocated. I'm currently using this method, but it feels a bit ugly and I feel that there got to be a better way to do it:
Code:
void md5Model::allocMeshes(int numMeshes)
{
meshes =(md5Mesh*)malloc(sizeof(md5Mesh)*(numMeshes+1));
isAlloc = true;
}
void md5Model::clear()
{
if (isAlloc)
free(meshes);
}
Do you know if there is any easier and/or better way to do this? I like malloc better than new, I don't know why though. Is it maybe better to use new, or doesn't it matter?
Thanks in advance
Daniel