[Issue 5493] New: Able to overwrite immutable data

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 26 12:54:37 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5493

           Summary: Able to overwrite immutable data
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: robert.welin at hotmail.com


--- Comment #0 from robert.welin at hotmail.com 2011-01-26 12:52:31 PST ---
Hello, I wrote a simple D program to test the immutable attribute and
discovered that by using standard input I could change immutable data, see code
below.

import std.stdio;

void main() {

    //Initialize string buf
    immutable char[] buf = "hello";
    writefln("buf = %s",buf);

    //Change value of buf with standard input
    stdin.readln(buf);
    writefln("buf = %s",buf);

}

Cheers
Robert

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


More information about the Digitalmars-d-bugs mailing list