Originally Posted by
sanddune008
How does that help?
It should: the space means that you are defining FREE to be "(a) bBosMemFree( a )" instead of defining FREE(a) to be "bBosMemFree( a )".
Originally Posted by
sanddune008
Anyways i tried didn't compile had same error....
Why does the error states:
error: 'a' undeclared (first use in this function)
My guess is that you tried wrongly. Try this test program:
Code:
#include <stddef.h>
void *pvBosMemAlloc(size_t size)
{
return NULL;
}
void *bBosMemFree(void *p)
{
return p;
}
#define MALLOC(size) pvBosMemAlloc( size )
#define FREE(a) bBosMemFree( a )
typedef unsigned char uint8;
typedef struct {
uint8 i;
char ch[6];
} mine;
uint8 zcl_SendCommand(mine *pMsg)
{
mine *rcv;
rcv = MALLOC(sizeof(mine));
/*Some code*/
FREE(rcv);
return 0;
}
int main(void)
{
return 0;
}
To demonstrate your error, change this:
Code:
#define FREE(a) bBosMemFree( a )
to:
Code:
#define FREE (a) bBosMemFree( a )
If you still face the same error after copying and pasting, then you should report a compiler bug to your compiler vendor.