Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

Macros
Utility Macros

## Macros
#define | SAFE_DELETE(a) if( (a) != NULL ) delete (a); (a) = NULL;
| Safely delete an object and set the pointer to NULL. More...
#define | SAFE_DELETE_ARRAY(a) if( (a) != NULL ) delete [] (a); (a) = NULL;
| Safely delete an array and set the pointer to NULL. More...
#define | SAFE_DELETE_OBJECT(a) if( (a) != NULL ) (a)->deleteObject(); (a) = NULL;
| Safely delete a SimObject and set the pointer to NULL. More...
#define | SAFE_FREE(a) if( (a) != NULL ) dFree ((void *)a); (a) = NULL;
| Safely free memory and set the pointer to NULL. More...
#define | SAFE_FREE_REFERENCE(a) if((a) != NULL) (a)->freeReference(); (a) = NULL;
| Safely free a reference to a Message and set the pointer to NULL. More...
#define | SAFE_DELETE_MESSAGE SAFE_FREE_REFERENCE
| Synonym for SAFE_FREE_REFERENCE() More...

## Detailed Description

## Macro Definition Documentation

#define SAFE_DELETE | ( |  | a | ) | if( (a) != NULL ) delete (a); (a) = NULL;

Safely delete an object and set the pointer to NULL.

Parameters

  a | Object to delete

See also
  SAFE_DELETE_ARRAY(), SAFE_DELETE_OBJECT(), SAFE_FREE(), SAFE_FREE_REFERENCE()

#define SAFE_DELETE_ARRAY | ( |  | a | ) | if( (a) != NULL ) delete [] (a); (a) = NULL;

Safely delete an array and set the pointer to NULL.

Parameters

  a | Array to delete

See also
  SAFE_DELETE(), SAFE_DELETE_OBJECT(), SAFE_FREE(), SAFE_FREE_REFERENCE()

#define SAFE_DELETE_MESSAGE SAFE_FREE_REFERENCE

Synonym for SAFE_FREE_REFERENCE()

Parameters

  a | Object to delete

See also
  SAFE_DELETE(), SAFE_DELETE_ARRAY(), SAFE_DELETE_OBJECT(), SAFE_FREE(), SAFE_FREE_REFERENCE()

#define SAFE_DELETE_OBJECT | ( |  | a | ) | if( (a) != NULL ) (a)->deleteObject(); (a) = NULL;

Safely delete a SimObject and set the pointer to NULL.

Parameters

  a | Object to delete

See also
  SAFE_DELETE_ARRAY(), SAFE_DELETE(), SAFE_FREE(), SAFE_FREE_REFERENCE()

#define SAFE_FREE | ( |  | a | ) | if( (a) != NULL ) dFree ((void *)a); (a) = NULL;

Safely free memory and set the pointer to NULL.

Parameters

  a | Pointer to memory to free

See also
  SAFE_DELETE_ARRAY(), SAFE_DELETE_OBJECT(), SAFE_DELETE(), SAFE_FREE_REFERENCE()

#define SAFE_FREE_REFERENCE | ( |  | a | ) | if((a) != NULL) (a)->freeReference(); (a) = NULL;

Safely free a reference to a Message and set the pointer to NULL.

Parameters

  a | Pointer to message to free

See also
  SAFE_DELETE_ARRAY(), SAFE_DELETE_OBJECT(), SAFE_FREE(), SAFE_DELETE()