compiler warnings for unconditional recursive calls



Why doesn't the compiler give me any warning if it encounters code like the following:

void foo()
{
// some code here
// foo() ist not nested in a pre-condition loop, some if- or else- // block and no return statement appears before it.
foo();
}

The compiler should recognize something like that, shouldn't it?
.



Relevant Pages

  • Re: fields for methods?
    ... but only by a compiler that is allowed to ... struct A {void foo();}; ... int static_instance i = 0; ... Is not possible because foo is the only member of A... ...
    (comp.programming)
  • Re: linking C++ functions in a C program
    ... contains one function named foo() which is compiled in C, ... Therefore, no matter how you classify bar(), this program ... void foo; ... guess the compiler can generate two references to foo, one adorned, ...
    (comp.lang.c)
  • Re: [C] return statement in void function?
    ... struct foo copy{ ... compiler really does have to think about. ... T foo (U fxn) ... > evaluates to void. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: linking C++ functions in a C program
    ... contains one function named foo() which is compiled in C, ... Therefore, no matter how you classify bar(), this program ... void foo; ... The C++ compiler processing main.C will see an extern "C" function named foo, and any time that C++ code calls it, it will call the unmangled C name instead of the default mangled C++ name. ...
    (comp.lang.c)
  • Re: Pointers to Functions
    ... >>inline void foo{ ... >>int main{ ... Yes it is using the latest VC++ optimising compiler, ... This is fine as the identifier foo is a const pointer to the function ...
    (alt.comp.lang.learn.c-cpp)