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

List at compile time

Name: Anonymous 2010-10-22 4:03

Hi /prog/.

I need some help, i want to make a list, but i want to make it at compile time using preprocessor macros.

I need to do something like this:

typedef struct shit {
char *name;
int num;
void *next;
} ass:

ass dong = {"dong", 0, NULL};
ass dick = {"dick", 1, &dong};

But i need to do it using macros so i can just safely append them to each other.

Help me

Name: Anonymous 2010-10-22 4:31

>>4
Write a program to parse your files and generate code for you. There is no preprocessor magic that will allow you to do this in pure C. Or you can use C++ constructors for this (store pointer to last node of list in global, and append a node to it in constructor of some dummy class), but then order will be undefined.

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