Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 831 Bytes

compiler-warning-level-1-c4717.md

File metadata and controls

33 lines (28 loc) · 831 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 1) C4717
Compiler Warning (level 1) C4717
11/04/2016
C4717
C4717
5ef3c6c7-8599-4714-a973-0f5b69cdab3c

Compiler Warning (level 1) C4717

'function' : recursive on all control paths, function will cause runtime stack overflow

Every path through a function contains a call to the function. Since there is no way to exit the function without first calling itself recursively, the function will never exit.

The following sample generates C4717:

// C4717.cpp
// compile with: /W1 /c
// C4717 expected
int func(int x) {
   if (x > 1)
      return func(x - 1); // recursive call
   else {
      int y = func(0) + 1; // recursive call
      return y;
   }
}

int main(){
   func(1);
}