How can I avoid this warning , thanks ~~~
B,R
Johnny
Show an example.
--
Ian Collins
Doctor, it hurts when I do "this".
I am guessing that the OP is doing something like this:
#undef A B
trying to undef both and b, but that's just a guess.
Sorry , this is my example , please help check :
void textDef(MyStruct *a, MyStruct *b, MyStruct *c )
{
int result;
CompVar lsVar = a->var();
CompVar midVar = c->var();
CompVar lgVar = b->var();
#define MyCheckVar(A,B,r); \
if( A==B ) r=-1; \
else if( A==lsVar && B==midVar ) r=1; \
else r=0;
.....
MyCheckVar( pa->var(), pb->var(), result );
.....
#undef MyCheckVar(A,B,r);
.....
}
B,R
Johnny
Just "#undef MyCheckVar"
Also, it's not advisable to use a macro for something
like this. See, for example, here:
http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.4
and
http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.5
Why not something like
inlin int check_var(CompVar A, CompVar B) {
return (A == B ? -1 : (A == lsVar && B == midVar ? 1 : 0))
}
?
--Jonathan
Dear Jonathan:
Thanks for your help ~~~ ^__^