Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Go to the source code of this file.
Macros | |
#define | STMT(STMT_code__) do { STMT_code__; } while(false) |
package code into a single statement. More... | |
#define | ONCE(ONCE_code__) |
execute the code passed as a parameter only the first time this is reached. More... | |
#define | ONCE_NOT(ONCE_code__) |
execute the code passed as a parameter except the first time this is reached. More... | |
#define | AT_STARTUP(code__) |
execute the code passed as a parameter before main is entered. More... | |
#define | SAFE_NEW(type, ptr) |
C++ new wrapper: allocates an instance of the given type and stores a pointer to it. More... | |
#define | SAFE_DELETE(p) |
delete memory ensuing from new and set the pointer to zero (thus making double-frees safe / a no-op) More... | |
#define | SAFE_ARRAY_DELETE(p) |
delete memory ensuing from new[] and set the pointer to zero (thus making double-frees safe / a no-op) More... | |
#define | SAFE_FREE(p) |
free memory ensuing from malloc and set the pointer to zero (thus making double-frees safe / a no-op) More... | |
#define AT_STARTUP | ( | code__ | ) |
execute the code passed as a parameter before main is entered.
WARNING: if the source file containing this is not directly referenced from anywhere, linkers may discard that object file (unless linking statically). see http://www.cbloom.com/3d/techdocs/more_coding.txt
#define ONCE | ( | ONCE_code__ | ) |
execute the code passed as a parameter only the first time this is reached.
may be called at any time (in particular before main), but is not thread-safe. if that's important, use std::call_once instead.
#define ONCE_NOT | ( | ONCE_code__ | ) |
execute the code passed as a parameter except the first time this is reached.
may be called at any time (in particular before main), but is not thread-safe.
#define SAFE_ARRAY_DELETE | ( | p | ) |
delete memory ensuing from new[] and set the pointer to zero (thus making double-frees safe / a no-op)
#define SAFE_DELETE | ( | p | ) |
delete memory ensuing from new and set the pointer to zero (thus making double-frees safe / a no-op)
#define SAFE_FREE | ( | p | ) |
free memory ensuing from malloc and set the pointer to zero (thus making double-frees safe / a no-op)
#define SAFE_NEW | ( | type, | |
ptr | |||
) |
C++ new wrapper: allocates an instance of the given type and stores a pointer to it.
sets pointer to 0 on allocation failure.
this simplifies application code when on VC6, which may or may not throw/return 0 on failure.
#define STMT | ( | STMT_code__ | ) | do { STMT_code__; } while(false) |
package code into a single statement.
STMT_code__ | code to be bundled. (must be interpretable as a macro argument, i.e. sequence of tokens). the argument name is chosen to avoid conflicts. |
notes: