Summary: Bulding with -D shouldn't an executable
--- Comment #0 from Jonathan M Davis <jmdavisp...@gmx.com> 2011-02-06 17:40:15
There's nothing on the page for the compiler (or in the --help for the
compiler, though it would probably be too verbose to put it that) which
indicates that building with -D or -version=D_Ddoc may not generate usable
code. It's perfectly legal to have a version(D_Ddoc) block which results in
code which is stubbed out, and it's _likely_ that that's going to be done in
cases where functions are system-specific, and you want to be able to build the
documentation on multiple platforms and/or build documentation for functions
which are only on a platform other than the one that you're building the
documentation on. Some of Phobos is in that sitatuation, and more of it will be
as it's fixed to be able to build documentation on all platforms instead of
just Windows. It can _also_ be useful to use version(D_Ddoc) blocks to generate
simplified function signatures in some cases, which would _also_ result in
unusable code if you build with -D.
It seems to me that we need to do one of two things if we don't want this to be
1. Alter dmd such that building with -D (and perhaps even when building with
-version=D_Ddoc if that's used explicitly), it does _not_ generate an
excecutable (or maybe any code at all) but just documentation. dmd _already_
doesn't build a normal executable when building with -unittest and -cov, so
that wouldn't be completely new (though -unittest and -cov generate altered
executables rather than none).
2. Make it clear in the dmd documentation that building with -D is _not_
generally expected to result in valid code. It will in many cases but not in
all. So, programmers should _not_ rely on it.
Personally, I'd prefer #1, but I'm not sure how Walter would feel about that.
If #1 is not reasonable, then #2 should be done.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------