www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - main can return almost anything (patched)

As reported earlier, there are checks on the
parameters to main but no checks on the return
type. This allows a few silly main constructs.

http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/2677

I still think allowing void main is a good idea,
just wished that it could return a code of 0
(EXIT_SUCCESS) back to the operating system...


I tried to implement such a default return
value for isMain() with a ret type of Tvoid,
but must have messed something up doing so ?

Guess the code generator does not like when
a function block with a void return type
suddently pushes a zero integer to it...


However, I did get the type warning right:
"main return type must be either void or int"
Patch for adding that check to DMD attached.

--anders
Feb 03 2005