On Saturday, 15 April 2023 at 14:33:52 UTC, kdevel wrote:
Does that make sense?

Whether it makes sense is subjective, but it is by design. Escape analysis considers every pointer the same, it doesn't care about the type / mutability of the pointer. In `@system` / `@trusted` code, you could coerce `i` to become a string and return it:

```D
string foo(string s, return ref int i)
{
   return (cast(immutable char*) &i)[0..4];
}
```

  • Re: Returning a ... kdevel via Digitalmars-d-learn
    • Re: Returni... Dennis via Digitalmars-d-learn
      • Re: Ret... kdevel via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... kdevel via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... kdevel via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn
        • Re:... kdevel via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn
        • Re:... kdevel via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn

Reply via email to