view tests/mini/arrays8.d @ 838:94ba810ea2b0

Fixed problem with nested function inside static nested function. see mini/compile_nested2.d. fixes #143 .
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 09 Dec 2008 14:57:01 +0100
parents 1bb99290e03a
children
line wrap: on
line source

module arrays8;

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

void main()
{
    char[] a = "hello ";
    printf("  \"%s\".length = %u\n", a.ptr, a.length);
    char[] b = "world";
    printf("  \"%s\".length = %u\n", b.ptr, b.length);
    char[] c = a ~ b;
    printf("After 'a ~ b':\n");
    printf("  \"%.*s\".length = %u\n", a.length, a.ptr, a.length);
    printf("  \"%.*s\".length = %u\n", b.length, b.ptr, b.length);
    printf("  \"%.*s\".length = %u\n", c.length, c.ptr, c.length);
    assert(c.length == a.length + b.length);
    assert(c !is a);
    assert(c !is b);
}