I have some doubt: I want to test whether some arrays, low and high, have been allocated before function call. The function begins with this test:
bool myMgr::compute(myInput *solvInput, double* low, double* high)
{
if(high==NULL||low==NULL)
return false;
//...
}
Am I testing anything, am I testing it right?
Thanks and regards
You are testing if the two pointers are not NULL, which is what heap allocators will return if they couldn’t allocate enough memory, but you can’t make others assumptions beyond that :
!= NULL, but initialized by the user : double* ptr = (double*)5;