Are there any default dmd optimizations

Jacob Carlborg doob at me.com
Sun Feb 24 04:07:39 PST 2013


On 2013-02-24 09:43, Jonathan M Davis wrote:

> Well, there are three aspects to what usually is meant by a debug build:
>
> 1. Debug symbols are compiled in.
>
> 2. Optimizations are not enabled.
>
> 3. Assertions _are_ enabled.
>
> For dmd, the first one is controlled by -g and -gc, the second one is
> controlled by -O (and probably to some extent by -release), and the third one
> is controlled by -release (and to some extent -noboundscheck). But what it
> actually means for a build to be "debug" or "release" really isn't all that
> well defined. It pretty much just boils down to one of them being compiled for
> debugging and development purposes, whereas the other is what's used in
> released code. In general though, when people compile release builds, they use
> all of the various flags for enabling optimizations and disabling debug symbols
> and assertions, whereas when they compile debug builds, they disable all
> optimizations and enable debugging symbols and assertions.
>
> But as for inlining, enabling it (or any other optimizations) screw with
> debugging, so they shouldn't be used with any builds which are intended for
> debugging, and with the way most compilers' flags work, optimizations aren't
> enabled unless you ask for them, making debug builds the default.

Then there's the -debug flag as well.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list