* * * * *
Stupid GCC Compiler Tricks
Years ago I implemented my own language, and in the process of writing that,
I seriously abused the C pre-processor to give me a form of template-based
programming (templates are now part of the C++ standard), and while using the
template wasn't that bad:
> void _MKFUNCTION(T_PREFIX,_matrix)(void)
> {
> char *s;
>
> s = get_token(fpin,whitespace);
> string_push(s);
> _MKFUNCTION(T_PREFIX,_matrixq)();
> }
>
But you had to be very careful how you included the templates stuff, or it
would most definitely blow up in your face.
But this—implementing a “read-evaluate-print-loop” in C, for C [1]—is sheer
genius. Or sheer insanity. I'm not sure which.
[1]
http://tlrobinson.net/blog/?p=31
Email author at
[email protected]