borrowed pointers vs ref
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 14 00:29:10 PDT 2014
On Tuesday, 13 May 2014 at 17:44:02 UTC, Walter Bright wrote:
> On 5/13/2014 6:50 AM, Dicebot wrote:
>> Walter's initial post implies that he wanted to re-used `ref`
>> for borrowed
>> pointer (which would mean same semantics as `scope` parameter
>> qualifier)
>
> 'ref' already is to much extent, for example:
>
> @safe int foo(ref int x) {
> auto a = &x;
> return 3;
> }
>
> dmd foo -c
> foo.d(4): Error: cannot take address of parameter x in @safe
> function foo
This has nothing to do with `ref`. If you remove the `ref` you
get the exact same error.
More information about the Digitalmars-d
mailing list