[Issue 5535] New: Bulding with -D shouldn't an executable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 6 17:42:39 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5535

           Summary: Bulding with -D shouldn't an executable
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2011-02-06 17:40:15 PST ---
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
causing problems:

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: -------


More information about the Digitalmars-d-bugs mailing list