Thread overview
[Issue 2494] New: describe explicit casting of arrays
Dec 06, 2008
d-bugmail
Dec 06, 2008
d-bugmail
Mar 12, 2010
Trass3r
Jan 23, 2012
Walter Bright
December 06, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2494

           Summary: describe explicit casting of arrays
           Product: D
           Version: 2.021
          Platform: PC
               URL: http://www.digitalmars.com/d/2.0/arrays.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: jlquinn@optonline.net


It's possible and necessary at times to cast arrays for systems work.  For example:

ubyte[] ba = readdata();
uint[] = cast(uint[])ba;

This isn't described and needs to be if it's supported in the language.  I'm assuming it's supported, because otherwise many things would be difficult.

Also, any limitations ala C++ aliasing rules need to be described.


-- 

December 06, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2494





------- Comment #1 from jarrett.billingsley@gmail.com  2008-12-06 13:26 -------
Huh, I would've expected it to be documented somewhere.  But yes, it's legal, and will throw a runtime error if there is a size mismatch (that is, if the size of the array in bytes is not an even multiple of the destination type element size).


-- 

March 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2494


Trass3r <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool@gmx.de


--- Comment #2 from Trass3r <mrmocool@gmx.de> 2010-03-12 13:11:51 PST ---
The only bit of information is at: http://www.digitalmars.com/d/2.0/expression.html#ArrayLiteral

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2494



--- Comment #3 from github-bugzilla@puremagic.com 2012-01-22 20:14:07 PST ---
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/8681d6fb36bd7a00a395bfc66205d5dbe8b19d88 Issue 2494 - describe explicit casting of arrays

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2494



--- Comment #4 from github-bugzilla@puremagic.com 2012-01-22 20:28:02 PST ---
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/8ae9018edcc3499480fa73d928d2be98b90a4fe7 free Issue 2494 - describe explicit casting of arrays

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2494


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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