www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2494] New: describe explicit casting of arrays

reply d-bugmail puremagic.com writes:
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.


-- 
Dec 06 2008
next sibling parent d-bugmail puremagic.com writes:
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).


-- 
Dec 06 2008
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Mar 12 2010