return in void functions

Stewart Gordon smjg_1998 at yahoo.com
Sat Mar 7 17:06:39 PST 2009


Walter Bright wrote:
> 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.

Why it allows you to return an int from a void-returning function???

Stewart.



More information about the Digitalmars-d mailing list