"for" statement issue
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 21 07:39:30 PDT 2016
On 10/21/16 10:28 AM, Kagamin wrote:
> On Friday, 21 October 2016 at 14:16:26 UTC, Steven Schveighoffer wrote:
>> How about in general forbidding lambda statements that aren't called
>> or used anywhere?
>
> How?
>
> int main()
> {
> int a;
> auto b = ()=>{a++;};
> b();
> assert(a==1);
> return 0;
> }
This lambda is both used in an assignment, and called.
If I do this:
10;
It's flagged as not having any effect. Similarly if I do:
() => 5;
Then it's not used/called. What is the point?
-Steve
More information about the Digitalmars-d
mailing list