void main returning int - why compiles?

Manfred_Nowak svv1999 at hotmail.com
Sat Jan 1 16:01:50 PST 2011


Daren Scot Wilson wrote:

> As shown, the "total evil" return statement gets a value from subroutine 
> foo().

>From the docs:
| Expression is allowed even if the function specifies a void return
| type. The Expression will be evaluated, but nothing will be returned.
| If the Expression has no side effects, and the return type is void,
| then it is illegal.  
  http://www.digitalmars.com/d/2.0/statement.html (cited 01/01/11)

_and_ foo() is not marked to have no side effects.

-manfred


More information about the Digitalmars-d-learn mailing list