-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCOND.h
39 lines (34 loc) · 894 Bytes
/
COND.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef COND_H
#define COND_H
#include "CORE.h"
/*!
*
* Condtional Expressions
* ----------------------
*
* !!! Warning !!!
*
* Both sides of the conditional will
* be fully evaluated. The preprocessor
* will THEN pick which side to use.
*
* It is important to take this into
* account because evaluating an errorous
* expression on the FALSE side will crash
* the preprocessor even if it is unused.
*
* This also becomes an issue for recursion
* as the preprocessor will continue to
* evaluate the loop until it hits the
* recursion limit, even if because of
* a conditional it will never be used.
*
* See RECR.h for what I have done to
* avoid this behaviour.
*
*/
#define IF_ELSE(C, T, E) JOIN(IF_ELSE_, C)(T, E)
#define IF_ELSE_0(T, E) E
#define IF_ELSE_1(T, E) T
#define IF(C, T) IF_ELSE(C, T, )
#endif