default values for inout parameters
Charlie
charlies at nowhere.com
Tue Dec 5 16:02:58 PST 2006
Yea I was trying to abuse it, you're right it shouldn't work with
default parameters, what I was really trying to do was something like
char [] x = char[]
Charlie
BCS wrote:
> Charlie wrote:
>> The following fails with : Error: "" is not an lvalue
>>
>> void f( inout char [] x = "" ){ }
>>
>> void main ()
>> {
>> f();
>> }
>>
>>
>> Why is this not allowed ?
>
> What would this do?
>
> void f( inout char [] x = "" )
> {
> x = "world";
> }
>
> It amounts to "take a literal reference to a static string and set it to
> something else". It doesn't really have a meaning.
>
> You could try shelling it by hand.
>
> void f() { char[] x = null; f(x);}
More information about the Digitalmars-d-learn
mailing list