[Issue 13637] New: std.utf.decode: index parameter should be able to pass by value

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 19 04:24:12 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13637

          Issue ID: 13637
           Summary: std.utf.decode: index parameter should be able to pass
                    by value
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: neuranuz at gmail.com

Is it reasonable to pass everywhere when it's possible by *ref* to function
even integers? This goes to very stupid bugs. If ref is neded there (but I
think it is not) we could use *auto ref* instead for those cases where it's not
possible get address of parameter or something else.

The above example doesn't compiles because we can't get *ref* for 0 literal

import std.stdio, std.utf;

void main()
{
    string str = "チ";

    writeln(decode(str, 0));    

}

--


More information about the Digitalmars-d-bugs mailing list