out parameter with default value

AsmMan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 29 09:07:49 PDT 2014


Why it does works:

void f(out int c)
{
    if(some_cond)
	c = 10;
}

but it doesn't?

void f(out int c = 1)
{
    if(some_cond)
	c = 10;
}

it give compiler error:

Error: constant 1 is not an lvalue


More information about the Digitalmars-d-learn mailing list