Unsigned char ucT2;
# define mT1AndT2 (ucT1 ucT2)
# define And (x, y) x & amp;=y
The main ()
{
And (mT1AndT2);
}
//
As above, complains, the number of parameters does not match, how can let the macro definition inside, and not an error?
CodePudding user response:
Unsigned char ucT1;Unsigned char ucT2;
# define mT1AndT2 (ucT1) & amp; (ucT2)
This directly
CodePudding user response:
May express is not clear, just a simple example,Actually have a lot of to be like this,
Unsigned char ucT1;
Unsigned char ucT2;
Unsigned char ucT3;
Unsigned char ucT4;
# define mT1AndT2 (ucT1 ucT2)
# define mT1AndT3 (ucT1 ucT3)
# define mT1AndT3 (ucT1 ucT4)
# define And (x, y) x & amp;=y
# define the Or (x, y) | x=y
The main ()
{
And (mT1AndT2);
Or (mT1AndT2);
And (mT1AndT3);
}
CodePudding user response:
Order from the outgoing, macro expansion and the order of the functions are called from inside to outside is theThe idea of you not
CodePudding user response:
In the macro body, if add a # before macro parameters, so in the macro expansion, macro parameters will be extended into the form of a string,