J
Jonathan.Fillion
Ok, I have a simple problem and I might just be blind and not see the
(possibly simple) solution to it. I want to declare variables while
adding them to a list simultaneously. What I want to do is something
like that:
int a, b, c;
int list[] = {&a, &b, &c};
But I only want to declare 'a', 'b' and 'c' once (they're declared 2
time here, one for the instance and one for the pointer in the list).
Now I figure it's possible to do that using a macro, but I just can't
figure out how, ie:
declare(list, int, a);
declare(list, int, b);
declare(list, int, c);
declare_instances();
declare_list_pointers();
You'd need some kind of way to store data in temporary memory with
macros. Is there something standard for doing that? (or a totally
different approach I haven't seen).
Thnx
(possibly simple) solution to it. I want to declare variables while
adding them to a list simultaneously. What I want to do is something
like that:
int a, b, c;
int list[] = {&a, &b, &c};
But I only want to declare 'a', 'b' and 'c' once (they're declared 2
time here, one for the instance and one for the pointer in the list).
Now I figure it's possible to do that using a macro, but I just can't
figure out how, ie:
declare(list, int, a);
declare(list, int, b);
declare(list, int, c);
declare_instances();
declare_list_pointers();
You'd need some kind of way to store data in temporary memory with
macros. Is there something standard for doing that? (or a totally
different approach I haven't seen).
Thnx