Rodney Harruff

CW chokes when calling functions with optional arguments.

Discussion created by Rodney Harruff on Nov 8, 2011
Latest reply on Nov 9, 2011 by Rodney Harruff

I'm using CW 7.2 Build 91218 with the coldfire architecture.  I have a mix of C and C++ in the project and have force C++ compilation checked in the C/C++ options.

 

Whenever I call a function and I leave out arguments that are defaulted in the function declaration, the compiler throws an error because the data types of the arguments in the function call don't match the function name and parameters list in any function declaration.

 

Example:

int foo(int a, int b = 0);

 

void main(int)

{

    foo(5);   // throws an error

    foo(5,0);   // doesn't throw an error

}

 

Does anyone have any idea why this would be happening?

 

Thanks,

Rod

Outcomes