return in void functions

Walter Bright newshound1 at digitalmars.com
Wed Mar 4 14:36:12 PST 2009


BCS wrote:
> IIRC D allows "return exp;" in a void function because it avoids special 
> cases in template code.
> 
> ReturnTypeOf!(AFn, T) fn(T)(T t)
> {
>    return AFn(t,t); // AFn might return void
> }

Yes, that's exactly why.



More information about the Digitalmars-d mailing list