--- In [email protected], "odbapsvm" <[EMAIL PROTECTED]> wrote:
>
> Does anyone know what happens if you call
> main from main and end up with an infinite loop?

int main(void)
{
    return main();
}

Compiled using gcc 3.4.6 under linux (CentOS 4). When run:

Segentation fault

What an anti-climax! I thought it would be much more interesting than
that :-)

I modified the program to keep a count of the number of times main was
called:

int main(void)
{
    static int n;
    n++;
    return main();
}

I ran it under gdb and examined the value of n when it crashed:
334058. Of no practical use of course...

Reply via email to