I am using the WIKI article, to write some cpp code. I found that
#define WHILE(pred, op, ...) \
IF(pred(__VA_ARGS__)) \
( \
OBSTRUCT(WHILE_INDIRECT) () \
( \
pred, op, op(__VA_ARGS__) \
), \
__VA_ARGS__ \
)
#define WHILE_INDIRECT() WHILE
#define pred( ...) 0
#define xxx( i) 1
{
EVAL( WHILE( pred, xxx, nothing))
}
produces
Which I think is wrong, because pred is always 0.
If I change IF to WHEN things are better:
For me its virtually impossible to write a functioning while loop with WHILE. First there is no example to steal from and the way pred and op have to be coded (is it even possible ?) is very unclear. I tried but gave up and wrote my own LOOP.
I am using the WIKI article, to write some cpp code. I found that
produces
Which I think is wrong, because
predis always 0.If I change
IFtoWHENthings are better:For me its virtually impossible to write a functioning while loop with WHILE. First there is no example to steal from and the way
predandophave to be coded (is it even possible ?) is very unclear. I tried but gave up and wrote my own LOOP.