Skip to content

Conversation

@dnadlinger
Copy link
Member

With the changes from this pull request, the following program does not allocate anymore:

extern(C) int printf(const char*, ...);

void main() {
    int[3] x = [1, 2, 3];
    printf("%d\n", x[2]);

    auto a = 4;
    int[3] y = [1, 2, a];
    printf("%d\n", y[2]);

    immutable int[] z = [1, 2, 3];
    printf("%d\n", z[2]);
}

dnadlinger added a commit that referenced this pull request Oct 9, 2013
Avoid allocating array literals on initialization
@dnadlinger dnadlinger merged commit 498b7cf into ldc-developers:master Oct 9, 2013
@dnadlinger dnadlinger deleted the sarray-init branch October 9, 2013 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant