[Issue 14859] New: static declared array with more than 16MB size should be allowed in struct and class declaration

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 1 15:08:42 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14859

          Issue ID: 14859
           Summary: static declared array with more than 16MB size should
                    be allowed in struct and class declaration
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: nightmarex1337 at hotmail.com

import std.stdio;

struct Stuff
{
    double someData, otherData;
    wchar[120] someFilePath;

    // byte[1024*1024*16] hugeArray; // Error: index 16777216 overflow for
static array

    byte[1024*1024*8] hugeArrayPart_1; // dirty hack
    byte[1024*1024*8] hugeArrayPart_2;

    SomeOtherComplexStruct theComplexStruct;
}

int main(string[] argv)
{
    Stuff* st = new Stuff();
    writeln((*st).sizeof);
    readln();
    return 0;
}

16MB or more sized types should be allowed in order to make above code work
without using dirty hacks

"global static sized arrays" and "static sized arrays inside static
class/struct" more than 16MB size should still not compile (or maybe a warning
is better?) they just blow up output size and also heard optlink cause problems
but don't know if it's relevant to above code.

--


More information about the Digitalmars-d-bugs mailing list