In short, possible. #define just makes the function to "strong" inline.
In long...
#define is interpreted by a preprocessor (not a compiler), this replaces all of reference to #define's code.
Example,
Code:
#define SOME_MACRO 16
...
int n[SOME_MACRO];
memset(n, 0, SOME_MACRO * sizeof(int));
for(int i = 0; i < SOME_MACRO; i++)
...
while compiling, this will be...
Code:
...
int n[16];
memset(n, 0, 16 * sizeof(int));
for(int i = 0; i < 16; i++)
...
Imagined ASM...
Code:
...
SUB ESP,16 * sizeof(int)
PUSH 16 * sizeof(int)
PUSH 0
LEA EAX,[ESP+8]
PUSH EAX
CALL memset
ADD ESP,12
PUSH EBX
XOR EBX,EBX
Addr1 :
...
INC EBX
CMP EBX,16
JL Addr1
POP EBX
...
ADD ESP,16 * sizeof(int)
hmm...
Code:
void MyOutput(const char *pszMsg)
{
ZChatOutput(MCOLOR(255,0,0), pszMsg, ZChat::CL_CURRENT);
}
...
MyOutput("1st.");
MyOutput("2nd.");
MyOutput("3rd.");
...
Code:
MyOutput :
PUSH EBP
MOV EBP,ESP
PUSH ESI
MOV ESI,[EBP-12]
PUSH ZChat::CL_CURRENT
PUSH ESI
PUSH MCOLOR(255,0,0)
CALL ZChatOutput
ADD ESP,sizeof(MCOLOR) + 8
POP ESI
POP EBP
RETN
...
PUSH "1st"
CALL MyOutput
PUSH "2nd"
CALL MyOutput
PUSH "3rd"
CALL MyOutput
ADD ESP,12
...
-------------------------
Code:
#define MyOutput(pszMsg) \
ZChatOutput(MCOLOR(255,0,0), pszMsg, ZChat::CL_CURRENT)
...
MyOutput("1st.");
MyOutput("2nd.");
MyOutput("3rd.");
...
Code:
...
PUSH ZChat::CL_CURRENT
PUSH "1st"
PUSH MCOLOR(255,0,0)
CALL ZChatOutput
ADD ESP,sizeof(MCOLOR) + 8
PUSH ZChat::CL_CURRENT
PUSH "2nd"
PUSH MCOLOR(255,0,0)
CALL ZChatOutput
ADD ESP,sizeof(MCOLOR) + 8
PUSH ZChat::CL_CURRENT
PUSH "3rd"
PUSH MCOLOR(255,0,0)
CALL ZChatOutput
ADD ESP,sizeof(MCOLOR) + 8
...
NOTE :Wrote in decimal, Also for ASM part I don't have confidence.