NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Warning (level 4) C4718

'function call' : recursive call has no side effects, deleting

A function contains a recursive call, but otherwise has no side effects. A call to this function is being deleted. The correctness of the program is not affected, but the behavior is. Whereas leaving the call in could result in a runtime stack overflow exception, deleting the call removes that possibility.

The following code generates C4718,

// compile with optimizations
int func(int x)
{
   if (x > 1)
      return func(x - 1); // recursive call
   else
      return x;
}

void func2(void)
{
   func(10);  // deleted; no side effects and return value used
}


void main() {
   func2();
}