Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid allocating array literals on initialization #493

Merged
merged 6 commits into from
Oct 9, 2013

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