3 ms·
A macro is a kind of function which is executed sometime before runtime, like at compile-time. Observe (aaa bbb ccc). If you just look at it as a datastructure
by calibraxis 15y ago
A macro is a kind of function which is executed sometime before runtime, like at compile-time.
Observe (aaa bbb ccc). If you just look at it as a datastructure, it's a list of 3 elements. If you look at it as executable code, then aaa is the operator, which operates on bbb and ccc.
If aaa is that special kind of operator which is a macro, it can rearrange (aaa bbb ccc) to be something different, which is then executed. Anything. It replaces itself with something else. If you programmed in a language like that, you'd never have to wait for some language designer to create a new for() loop. Because you could easily write a loop which is then transformed into the usual for(i=0;...) loop.