view tests/mini/foreach11.d @ 1651:cb960b882ca3 default tip

bindings were moved to dsource.org/projects/bindings/
author Moritz Warning <moritzwarning@web.de>
date Thu, 20 May 2010 20:05:03 +0200
parents 8baf611f0009
children
line wrap: on
line source

module foreach11;

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

void main() {
    char* last = null;
    printf("The addresses should remain constant:\n");
    foreach (c; "bar") {
        auto a = {
            printf("%x '%c'\n", c, c);
            printf("ptr = %p\n", &c);
            if (last)
                assert(last == &c);
        };
        a();
        last = &c;
    }
}