logoalt Hacker News

sebstefanyesterday at 6:20 PM1 replyview on HN

```

#define _(e...) ({e;})

#define x(a,e...) _(s x=a;e)

#define $(a,b) if(a)b;else

#define i(n,e) {int $n=n;int i=0;for(;i<$n;++i){e;}}

```

>These are all pretty straight forward, with one subtle caveat I only realized from the annotated code. They're all macros to make common operations more compact: wrapping an expression in a block, defining a variable x and using it, conditional statements, and running an expression n times.

This is war crime territory


Replies

maldevyesterday at 9:23 PM

Some of these are wrong to. You can encounter issues with #define

#define $(a,b) if(a)b;else

due to not having brackets. So it's just extremely lazy to.

show 1 reply