www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9691] New: Static void arrays are not documented

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

           Summary: Static void arrays are not documented
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



12:08:29 PDT ---
There is no documentation stating how static void arrays are implemented.

In particular, what is their actual element size? It seems they're byte-sized:

void main()
{
    byte[2] x;
    int[2] y;

    void[2] a = x;  // ok
    void[2] b = y;  // runtime error: 8 bytes does not fit into 2 bytes
}

But this needs to be documented. The last statement should probably also be a
compile-time error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9691


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx



I don't like the concept of void[]. It makes me think the element size is 0,
and therefore the array is always 0-sized. But it seems the element size of
void[] is 1. So then why not ubyte[]? That's basically what it is: you're
treating the data as an array of bytes instead of an array of whatever other
type it may have been.

(Yes an unsafe cast is needed but you're already doing that implicitly by
passing T[] to void[] in the first place.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 15 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9691




12:59:25 PDT ---

 I don't like the concept of void[].
Well the theory is the GC would avoid scanning ubyte[] for pointers unlike void[]. I don't know if that's true or not, it's been mentioned in the newsgroups a few times. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 17 2013