checkedTo

Jonathan M Davis jmdavisProg at gmx.com
Thu Nov 3 08:54:14 PDT 2011


On Thursday, November 03, 2011 13:38:44 Gor Gyolchanyan wrote:
> I think this could be integrated into "to" template without need for
> extra symbols.
> There are tons of optimization opportunities like this, that are
> currently not being utilized.
> If the result won't change, then the release version should drop safety
> checks.

And how would std.conv.to know that the result won't change? It k
nows nothing about the variable it's being passed, and that variable could 
depend on user input or what's in a file or some other value which is runtime-
dependent.

I don't believe that anything in Phobos changes behavior based on -debug 
(there are a few places where -debug=something results in a module printing 
extra stuff for unittests - e.g. -debug=string for std.string - but not for -
debug), and -debug is really meant for debugging purposes, not for enabling or 
disabling checks. That's for -release, which, for better or worse, you can't 
actually check for in code. So, really, there is no way to have -release affect 
any code in Phobos beyond what it does to the language in general (remove 
assertions and remove array bounds checking in @system code), even if we 
wanted it to, which is debatable.

- Jonathan M Davis


More information about the Digitalmars-d mailing list