Brett McCoy wrote:
> On Sat, May 24, 2008 at 3:31 PM, odbapsvm <[EMAIL PROTECTED]> wrote:
>> Does anyone know what happens if you call
>> main from main and end up with an infinite loop?
>>
>> void main(void) {
>>
>>              void main();
>> }
>>
>> Will you exhaust memory, crash the machine or
>> neither.
>>
>> I know that nothing would be more educational than
>> trying it, but I thought that doing this might
>> be somewhat dangerous.
> 
> I think in ANSI C you can call diredtly main(), I believe, but not in
> C++. But don't quote me on that, check the standard.
> 
> BTW, main always returns int, it's never void
> 
> -- Brett
> ------------------------------------------------------------
> "In the rhythm of music a secret is hidden;
>  If I were to divulge it, it would overturn the world."
>  -- Jelaleddin Rumi
> 
> ------------------------------------

C++
-----
Comeau C/C++ 4.3.10.1 (May  7 2008 20:26:48) for ONLINE_EVALUATION_BETA1
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ C++0x_extensions

"ComeauTest.c", line 3: error: function "main" may not be called or have its
           address taken
     main();
     ^
-----


C
-----
Comeau C/C++ 4.3.10.1 (May  7 2008 20:26:48) for ONLINE_EVALUATION_BETA1
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C99


In strict mode, Compile succeeded.
-----




-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to