Macros in C help please

I dont knw if anyone can help me but:

Here is my macro:

#define __CALC_CURRENT__ (a,b) ((a) * (b))

It basically multiplies a by b.

When calling the macro i use this:

curX = __CALC_CURRENT__(tree->branches[n].dirX, tree->branches[n].length);

For some reason and i dont know why i get the following errors:

  
error C2065: 'a' : undeclared identifier
error C2065: 'b' : undeclared identifier
error C2064: term does not evaluate to a function
error C2064: term does not evaluate to a function
error C2064: term does not evaluate to a function

And it all relates to calling the macro.

I have erad the indispensible guide to C part on macros and cant see the problem.

Can someone please help. Thanks.

Remove the space behind CALC_CURRENT in the definition. :slight_smile:
Your compiler has expanded the call to
curX = (a,b) ((a) * (b))(tree->branches[n].dirX, tree->branches[n].length);

thanks that solved it.

Wohoo it works!!!