default parameters in Dave

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi there,
I have tried default parameters but DAVE showed an error message. Here a simple code example:

int mult(uint32_t x,uint32_t y=1)
{
return x*y;
}

Has anybody an idea what's wrong here?

thanks in advance
0 Likes
2 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
What error message did you see?

If the value of Y is known, than it should not be as the function input.

int mult(uint32_t x)
{
return x*1;
}
0 Likes
Not applicable
thanks for quick response,

the second parameter y is meant as default parameter, that means that it is optional when calling the function. In this case y would default to 1.
I use it convenienty with other c++ compilers and documentation is also found in the internet.
By the way, where can I find documentation on the c++ compiler used by dave?
0 Likes