What's the deal with -boundscheck?
weaselcat via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 5 19:33:03 PDT 2015
On Monday, 6 April 2015 at 02:13:42 UTC, Andrei Alexandrescu
wrote:
> I've spent the better part of yesterday and today debugging a
> complex matter involving pointers, reduced to this:
>
> ../dmd/src/dmd -conf= -I../druntime/import -w -dip25 -m64 -O
> -release -main -unittest generated/osx/release/64/libphobos2.a
> -defaultlib= -debuglib= -L-lcurl -run
> std/experimental/allocator/kernighan_ritchie.d
>
> In this configuration, surprisingly there's no bounds checks
> inserted. I need to explicitly add -boundcheck=on.
>
> Why the change? I've fought tooth and nail for keeping bounds
> checking in release mode and with optimizations on, precisely
> because I think it's a check that's valuable enough to warrant
> explicit disabling.
>
> Could someone please explain. This is a shame.
>
>
> Andrei
bounds checks are only enabled by default in @safe code when
compiled with -release
http://dlang.org/dmd-linux.html
More information about the Digitalmars-d
mailing list