#include <windows.h> typedef enum { VALUE_STATE_NOT_AVAILABLE = 1, VALUE_STATE_ERROR = 2, VALUE_STATE_VALID = 3, VALUE_STATE_UNKNOWN = 4 } XyzValueState_t; class XyzValue { private: XyzValueState_t _valueState; protected: XyzValue( XyzValueState_t valueState ) { _valueState = valueState; } } typedef XyzValue* xyzValuePtr_t; main(){ bool flag=true; xyzValuePtr_t* values = NULL; unsigned int _argument=2; if(flag==true) { values = new PCLValuePtr_t[2]{ NULL,NULL }; try { values[0] = new PCLUnsignedInteger(_argument); values[1] = new PCLUnsignedInteger(_argument); xyz(values); // passing the value to third party function which returns void } catch(...) { if(values!= NULL){ for(int k = 0; k < 1; k++) { delete values[k]; values[k] = NULL; } delete [] values; values = NULL; } } } }
values = new PCLValuePtr_t[2]{ NULL,NULL };
if(values!= NULL)
try...catch...
values
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)