Error: constant false is not an lvalue

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 31 06:19:12 PDT 2009


On Sun, 30 Aug 2009 11:25:59 -0400, Ellery Newcomer  
<ellery-newcomer at utulsa.edu> wrote:

> Steven Schveighoffer wrote:
>> On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer
>> <ellery-newcomer at utulsa.edu> wrote:
>>
>>> void blah(out bool a = false){
>>>  // blah blah blah
>>> }
>>>
>>> compile time use of blah results in error.
>>>
>>> Am I doing anything wrong?
>>
>> out implies a reference.  You can't have a reference to a manifest
>> constant like that.
>
> Are you saying a parameter like
>
> out type a = b
>
> implies the function assigns b's memory location to a?

In a parameter list?  What this does:

void foo(int i = 4);

is allow you to call foo with no arguments, and i is initialized to 4.

Now, let's say foo is written like this:

void foo(ref int i = 4);

What is i referencing when you call:

foo();

???

-Steve


More information about the Digitalmars-d-learn mailing list