On Saturday, 15 April 2023 at 14:10:57 UTC, Dennis wrote:
[...]
This adds complexity, just to add some 'intermediate' safety between `@system` and `@safe` in a few cases. It's better to keep the rules simple and consistent.

Thanks for the answer! While playing around with return ref I came across this:

```
string foo (string s, return ref int i)
{
   return s;
}

auto bar ()
{
   int i;
   string s;
   return foo (s, i);
}
```

```
$ dmd rr.d
rr.d(10): Error: returning `foo(s, i)` escapes a reference to local variable `i`
```

Does that make sense?
  • Re: Returning a ... Bastiaan Veelo via Digitalmars-d-learn
    • Re: Returni... kdevel via Digitalmars-d-learn
      • Re: Ret... Dennis via Digitalmars-d-learn
        • Re:... kdevel via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... kdevel via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... kdevel via Digitalmars-d-learn
          • ... Dennis via Digitalmars-d-learn
          • ... Dennis via Digitalmars-d-learn
          • ... kdevel via Digitalmars-d-learn
          • ... Dennis via Digitalmars-d-learn
          • ... kdevel via Digitalmars-d-learn
          • ... Dennis via Digitalmars-d-learn

Reply via email to