S
s.subbarayan
Dear all,
I encountered a macro in one of the file i got from our software
vendor.This piece of code is used for tracing the debug messages.I am
not able to understand this line:
#define MASTER_STATE(p) ( ((p)->State) >=
STI2C_MASTER_ADDRESSING_WRITE )
So can some one explain me what it attempts to do?My main doubt is can
we have pointers like the ("p") present in the code above in macro
definitions?If so should we not intialise it before calling?And to my
amazement I never find any initialisation for p.also can we do type
checking inside a macro ?Like make sure the user passes only
integer?or is it a drawback of macros that they cant do any type
checking?
How can "p" point to state in above code with out initialising?
note:the "state" mentioned above is a structure variable.theres one
structure by name "statedef" and this "state" is a variable of type
"statedef".
I would appreciate any help and advanced thanks for the same.
Regards,
s.subbarayan
I encountered a macro in one of the file i got from our software
vendor.This piece of code is used for tracing the debug messages.I am
not able to understand this line:
#define MASTER_STATE(p) ( ((p)->State) >=
STI2C_MASTER_ADDRESSING_WRITE )
So can some one explain me what it attempts to do?My main doubt is can
we have pointers like the ("p") present in the code above in macro
definitions?If so should we not intialise it before calling?And to my
amazement I never find any initialisation for p.also can we do type
checking inside a macro ?Like make sure the user passes only
integer?or is it a drawback of macros that they cant do any type
checking?
How can "p" point to state in above code with out initialising?
note:the "state" mentioned above is a structure variable.theres one
structure by name "statedef" and this "state" is a variable of type
"statedef".
I would appreciate any help and advanced thanks for the same.
Regards,
s.subbarayan