3 ms·
Conor: ...it’s not C, it’s like a macro variant of C, where it’s a CDSL, where 80% of your “library” is macros. I did a search, there’s 10,000 macros in the sou
by buescher 5y ago
Conor: ...it’s not C, it’s like a macro variant of C, where it’s a CDSL, where 80% of your “library” is macros. I did a search, there’s 10,000 macros in the source code, and those macros are used like functions ... some of the exact same macros that exist in the J code base are exactly what competitive programmers use.
He is, of course, talking about things like this (from the "J incunabulum"):
#define DO(n,x) {I i=0,_n=(n);for(;i<_n;++i){x;}}
Which is actually pretty concise and readable. Sometimes I think it would be nice if enough people could agree on a header library of "concise C" macros that they could become part of the idiom. Or at least a minority dialect instead of an idiolect.
- CyberDildonics 5y agoThis still makes you put the execution as a macro argument, but the benefit comes from the fact that most of the time a loop can just go from 0 to a given number. If just the for loop is in the macro you can put the braces in yourself. If the braces are up to you, nested loops are cleaner. DO(y,height) DO(x, width) blur(x,y);