[Issue 2020] version(release) is missing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 25 18:30:44 PST 2012


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-25 18:30:32 PST ---
Use-cases that I can think of:

- Enable certain code-path only when maximum performance is required (it might
be expensive at compile-time too so it's wrapped in a `version(release)`)

I can't think of anything else. In fact I'm against this. Since the user
ultimately controls the switches passed to the compiler there's nothing
stopping the user from passing `-version=release`. 

Also it could easily break linking with libraries. Suppose a library has this
code:

version(release)
{ 
    void foo(int x, int y = 1) { }
}
else 
{   
    void foo(int x) { }
}

And the user creates a static library without using -release. Then, the user
decides to compile his app with -release and use the existing precompiled
static library. He will get linker errors because the right `foo` might not
have been compiled in. (Please note that *this* example might not give you
linking errors because DMD can inline the call)

I know the same issue can appear with other version statements, however
'-release' is used often enough that this could become a common problem. And it
would be extremely confusing for novice users to get linking errors because
they've decided to use -release.

Other than that, yes it's simple to implement in the compiler.

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