… | |
… | |
23 | // that is in scope for the next statement only |
23 | // that is in scope for the next statement only |
24 | // works only for stuff that can be assigned 0 and converts to false |
24 | // works only for stuff that can be assigned 0 and converts to false |
25 | // (note: works great for pointers) |
25 | // (note: works great for pointers) |
26 | // most ugly macro I ever wrote |
26 | // most ugly macro I ever wrote |
27 | #define declvar(type, name, value) if (type name = 0) { } else if (((name) = (value)), 1) |
27 | #define declvar(type, name, value) if (type name = 0) { } else if (((name) = (value)), 1) |
|
|
28 | |
|
|
29 | // in range including end |
|
|
30 | #define IN_RANGE_INC(val,beg,end) \ |
|
|
31 | ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg)) |
|
|
32 | |
|
|
33 | // in range excluding end |
|
|
34 | #define IN_RANGE_EXC(val,beg,end) \ |
|
|
35 | ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) |
28 | |
36 | |
29 | // makes dynamically allocated objects zero-initialised |
37 | // makes dynamically allocated objects zero-initialised |
30 | struct zero_initialised |
38 | struct zero_initialised |
31 | { |
39 | { |
32 | void *operator new (size_t s, void *p) |
40 | void *operator new (size_t s, void *p) |