|
Pyrogenesis
13997
|
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
Definition at line 82 of file code_generation.h.
| #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 pthread_once() instead.
Definition at line 49 of file code_generation.h.
| #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.
Definition at line 65 of file code_generation.h.
| #define SAFE_ARRAY_DELETE | ( | p | ) |
delete memory ensuing from new[] and set the pointer to zero (thus making double-frees safe / a no-op)
Definition at line 121 of file code_generation.h.
| #define SAFE_DELETE | ( | p | ) |
delete memory ensuing from new and set the pointer to zero (thus making double-frees safe / a no-op)
Definition at line 111 of file code_generation.h.
| #define SAFE_FREE | ( | p | ) |
free memory ensuing from malloc and set the pointer to zero (thus making double-frees safe / a no-op)
Definition at line 131 of file code_generation.h.
| #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.
Definition at line 96 of file code_generation.h.
| #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:
Definition at line 41 of file code_generation.h.
1.8.5