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.
int foo(int a, int b = 0);
foo(5); // throws an error
foo(5,0); // doesn't throw an error
Does anyone have any idea why this would be happening?
What is the extension of the source file, where you place the function prototype for foo (.c or .cpp)?
Where is the function foo implemented (in a .c or ,cpp file)?
What error message are you getting exactly?
The function declaration was a class constructor in a .h file. The error was flagged when an instance of the class was statically instantiated in a .cpp file. I don't remember the exact text of the error other than it was the one you see when the data types of the arguments in a function call don't exactly match the data types of the parameters in the function declaration.
I tried to code a simple solution from a new project and I couldn't duplicate the compile error when calling a function with optional arguments.
I saw the problem when I ported a bunch of code from another project and I had hundreds of errors to fix. I have since fixed all of the seemingly unrelated errors and now I can't duplicate the problem.
I'm going to assume that this is a non-issue, until I see the error when I have no other errors in my project.