Possible enhancement: Concise return statements

David Nadlinger see at klickverbot.at
Mon Aug 15 13:27:56 PDT 2011


On 8/15/11 10:05 PM, Walter Bright wrote:
> On 8/15/2011 12:17 PM, Steven Schveighoffer wrote:
>> What is going to happen if someone adds an extra ';' ? Compiler error
>> ("no
>> return statement")
>
> Such lambdas are often used with 'auto' returns, so you'd get no
> compiler error, but a subtle in the way your program works.

Do you have an actual example for this in mind? In every situation where 
you actually use the return value, »changing its type to void« would 
give you tons of compiler errors. If you are not using the return value 
anyway – who cares?

David


More information about the Digitalmars-d mailing list