Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Useful C Macros

Name: Anonymous 2010-01-12 15:24

Let's share the macros we use that make our C code really EXPERT!!

Right now I'm specifically interested in macros to add half-assed object orientation. Thanks!!

I'll contribute myself:
#define mainstart int main(int argc, char **argv) {

Name: Anonymous 2010-01-12 15:33

I wrote some macros to add OO "support" to C, it took about 1 page of C code. It's really simple stuff that anyone could do if they knew how vtables work, but I think that the vtable aproach is flawed by itself, all you need is just tagged structures and functions to operate on them. More interesting macros would be things like foreach or DOLIST. Too bad C macros are very limited (just text replacement) and can't do the things real macros that Lisp has (you have the full power of the environment when you write a macro, which makes writing compilers quite fun and easy).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List