Are there any default dmd optimizations
Jonathan M Davis
jmdavisProg at gmx.com
Sun Feb 24 14:53:21 PST 2013
On Sunday, February 24, 2013 14:28:42 Walter Bright wrote:
> On 2/24/2013 12:57 PM, Andrej Mitrovic wrote:
> > On 2/24/13, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> >> Yeah, which just adds the confusion, because all it does is enable debug
> >> bocks.
> >
> > The feature almost doesn't pay its weight. I mean technically you can
> > use -version=Debug and then use version(Debug) blocks. All `debug`
> > does is saves a little bit of typing.
>
> I should explain the reasoning for this.
>
> I've talked to many C/C++ programming managers. They lament that every C/C++
> coding group feels compelled to reinvent their own debug macro scheme. This
> makes it pointlessly difficult to share code between groups.
>
> It's not that unlike how pre-C++98 code bases all had their own "string"
> class.
>
> By baking one scheme into the language, people will rarely feel a need to
> reinvent the wheel, and will go on to more productive uses of their time.
I don't disagree with any of this. It's just that the name of the flag (-debug)
is unfortunate due to the confusion it helps engender with regards to the
difference between "release" and "debug" builds. I don't know what else the flag
could have reasonably been called though. Alternatively, version(Debug) could
have been used instead (complete with whatever special capabilities debug
statements currently grant - e.g. skipping purity checks), but that also might
make the feature just enough more obscure that it wouldn't be used as much.
So, I don't know that we have a good solution to the problem or that there's
anything obvious that we could have done differently were we to have known
better when the feature was first introduced, but there _are_ some downsides to
the current scheme.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list