betterC and noboundscheck

Michael V. Franklin slavo5150 at yahoo.com
Sat Nov 25 03:57:46 UTC 2017


On Wednesday, 22 November 2017 at 15:10:40 UTC, Oleg B wrote:

> import core.stdc.stdio;
> import std.algorithm : min;
>
> extern (C) void main()
> {
>     char[256] buf;
>     buf[] = '\0';
>
>     auto str = "hello world";
>     auto ln = min(buf.length, str.length);
>     buf[0..ln] = str[0..ln];
>     printf("%s\n", buf.ptr);
> }
>
> rdmd -betterC bettercarray2.d
>
> and get error:
>
> /tmp/.rdmd-1000/rdmd-bettercarray2.d-435C14EC3DAF09FFABF8ED6919B624C1/objs/bettercarray2.o: In function `main':
> bettercarray2.d:(.text.main[main]+0xbc): undefined reference to 
> `_d_arraycopy'
> collect2: error: ld returned 1 exit status
> Error: linker exited with status 1


Bug submitted here: https://issues.dlang.org/show_bug.cgi?id=18010


More information about the Digitalmars-d-learn mailing list