Thread overview | |||||
---|---|---|---|---|---|
|
April 21, 2008 [Issue 2020] New: version(release) is missing | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2020 Summary: version(release) is missing Product: D Version: 2.012 Platform: PC OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: wbaxter@gmail.com There are times you may want to do something differently in a final release version, just as the built-in D array types do. It appears this could be added fairly simply. In src/dmd/mars.c there's this code: if (global.params.release) { global.params.useInvariants = 0; global.params.useIn = 0; global.params.useOut = 0; global.params.useAssert = 0; global.params.useArrayBounds = 0; global.params.useSwitchError = 0; } I think just adding this line inside the 'if' would do the trick: VersionCondition::addPredefinedGlobalIdent("release"); If not, it can't be much more complicated than that. -- |
December 26, 2012 [Issue 2020] version(release) is missing | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2020 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@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: ------- |
December 26, 2012 [Issue 2020] version(release) is missing | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2020 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-12-25 19:12:52 PST --- There is no a version(assert) that will be enabled when assertions are enabled, which takes care of many of the use cases where version(release) would be useful (though clearly version(assert) is the opposite of version(release)). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation