macroses in VEX

   3096   3   0
User Avatar
Member
66 posts
Joined: Oct. 2008
Offline
If i need to declare several groups of some similar looking variables, e. g.

int usepointclr_1 =0;
string cdname_1 = “cd_param_1”;

int usepointclr_2 =0;
string cdname_2 = “cd_param_2”;

i can do the following :

#define EXAMPLE(postfix, cd_param) \
int usepointclr##postfix =0; \
string cdname##postfix= cd_param;

and then use my EXAMPLE macros to declare variables

EXAMPLE(_1, cd_param_1)
EXAMPLE(_2, cd_param_2)

And now the question is:

ARE there ways to do the same stuff with #pragma's ? E. g. if i have

#pragma label “Use Point Color 1” usepointclr_1
#pragma label “Use Point Color 2” usepointclr_2
#pragma label “Use Point Color 3” usepointclr_3 e.t.c.

how should i automate typing #pragma's instructions using macroses ? (if it is possible)
User Avatar
Member
941 posts
Joined: July 2005
Offline
I'm pretty sure vcc doesn't do macro expansions for #pragma's.
So no, I don't think you'll be able to “macrotize” your pragma's
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
66 posts
Joined: Oct. 2008
Offline
May be it's worth to post that stuff to RFE
User Avatar
Member
941 posts
Joined: July 2005
Offline
morzh
May be it's worth to post that stuff to RFE

Maybe… but I wouldn't hold my breath. The default behaviour of most cpp implementations is to *not* expand macros in pragmas (Microsoft might be an exception though).
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links