Top 5

bearophile bearophileHUGS at lycos.com
Wed Oct 8 16:14:33 PDT 2008


Sean Kelly:
> We can generally use alloca for this in D, so I don't consider this a 
> major issue.  Be pretty cool to have it in-language though.

Time ago I have shown this bug that I think may be of alloca():

import std.c.stdlib: alloca;
void main() {
    const int n = 8;
    for (int i; i < 2; i++)
        printf("%p\n", alloca(n));
}

Error: it prints two times the same address.

(I also think alloca of DMD is currently not much fast, compared to the allocation of variable length arrays of C99 of GCC, but I don't have hard data to support this at the moment).

Bye,
bearophile



More information about the Digitalmars-d mailing list