On Monday, 12 December 2016 at 06:28:09 UTC, Shachar Shemesh wrote:

DMD 2.072.1 and ldc 2.070.2

It's easy to verify. Just create a large array (1M) and check the segment sizes of the result.

For LDC, it depends whether the variables are defined inside a function or not.

```
immutable ubyte[] array1 = [ 1, 2, 3, 4 ]; // ends up in data section immutable ubyte[] array2 = cast(immutable ubyte[]) x"01 02 03 04"; // not in data section

void foo()
{
    // Both initializers are _not_ put in the data section.
    immutable ubyte[] array1 = [ 1, 2, 3, 4 ];
immutable ubyte[] array2 = cast(immutable ubyte[]) x"01 02 03 04";
}
```

The module-scope variable's initializer ending up in the data section is a bug I think, but I have not thought it through enough.

-Johan

Reply via email to