In the past when I've done this:
int function(int a)
{
if(a == 2)
{
return true;
}
else
{
return false;
}
}
the compiler has complained that the function may not return a value. I've fixed this by adding:
int function(int a)
{
if(a == 2)
{
return true;
}
else
{
return false;
}
return false;
}
but now a different compiler is complaining that the last line is "unreachable code" (which I agree with). How is this usually handled?
Thanks,
David