[Issue 5846] String literals can be assigned to static char arrays without .dup

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 18 06:11:08 PDT 2011


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy at yahoo.com
         Resolution|                            |INVALID


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-04-18 06:07:35 PDT ---
No.  It is valid.

value is allocated on the stack, or in TLS depending on where you declared it. 
Assigning it to the literal does not make it reference the actual literal data,
it just copies the data into the value.

In other words, changing an element of value does not change the immutable
memory that the literal refers to.

-- 
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