Type Qualifiers and Wild Cards

Don nospam at nospam.com
Tue Nov 8 00:44:02 PST 2011


On 08.11.2011 09:33, Walter Bright wrote:
> On 11/8/2011 12:16 AM, Timon Gehr wrote:
>> Nice article!
>
> Thanks!
>
>
>> > It isn't a template, and inout can only be used on function
>> parameters and
>> the return value.
>>
>> What about local variables?
>
> Just use const for them.

This compiles:

inout(int *) foo(inout(int *) a)
{
    inout x = a;
    return x;
}

and it doesn't compile if you replace 'inout x' with 'const x'.



More information about the Digitalmars-d mailing list