www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11560] New: API returning immutable string on stack?

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11560

           Summary: API returning immutable string on stack?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: turkeyman gmail.com


--- Comment #0 from Manu <turkeyman gmail.com> 2013-11-19 22:37:12 PST ---
This code:
  string hash = std.digest.digest.toHexString(std.digest.sha.sha1Of("text"));

Does it seem reasonable that users should expect that 'hash' is on the stack?
As the program continues, 'hash' starts changing randomly.
hash.idup, it persists as expected.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11560


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2013-11-20 17:59:54 EST ---
A compilable test case that shows the problem would be helpful.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11560



--- Comment #2 from Manu <turkeyman gmail.com> 2013-11-19 23:30:17 PST ---
(In reply to comment #1)
 A compilable test case that shows the problem would be helpful.
string func() { string hash = std.digest.digest.toHexString(std.digest.sha.sha1Of("text")); return hash; } void main() { string s = func(); std.stdio.writeln("hello world"); // call a funtion std.stdio.writeln(s); // s is rubbish } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 19 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11560


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from yebblies <yebblies gmail.com> 2013-11-20 18:42:36 EST ---
*** This issue has been marked as a duplicate of issue 9279 ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2013