Compiler Error C2202

'function' : not all control paths return a value

The specified function can potentially not return a value.

The following is an example of this error:

int func1( int i )
{
   if( i ) return 3;  // error, nothing returned if i == 0
}

To fix this error, modify the code so that all paths assign a return value to the function:

int func1( int i )
{
   if( i ) return 3;
   else return 0;     // OK, always returns a value
}

It is possible that your code may contain a call to a function that never returns, as in the following example:

int gloo()
{
   if(...)
     return 1;
   else if(...)
     return 0;
   else
     fatal();
}

This code also generates an error, because the compiler does not know that fatal never returns. To prevent this code from generating an error message, declare fatal using __declspec(noreturn).