|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - How to make invariant switchable
Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it will be quite helpful to generate test version and release version of software. Best regards Qian Xu Jun 18 2009
Qian Xu Wrote:Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it will be quite helpful to generate test version and release version of software. Best regards Qian Xu Jun 18 2009
Jason House wrote:Qian Xu Wrote:Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it will be quite helpful to generate test version and release version of software. Best regards Qian Xu Jun 18 2009
Denis Koroskin wrote:No, they wont. Jun 18 2009
On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" <2korden gmail.com> wrote:On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu <quian.xu stud.tu-ilmenau.de> wrote:Denis Koroskin wrote:No, they wont. Jun 18 2009
On Thu, 18 Jun 2009 19:28:41 +0400, "Denis Koroskin" <2korden gmail.com> wrote:On Thu, 18 Jun 2009 17:46:37 +0400, Max Samukha <outer space.com> wrote:On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" <2korden gmail.com> wrote:On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu <quian.xu stud.tu-ilmenau.de> wrote:Denis Koroskin wrote:No, they wont. Jun 18 2009
Max Samukha:Why would you want to leave asserts in a release build while they are supposed to be used for debugging? Jun 18 2009
bearophile wrote:Max Samukha:Why would you want to leave asserts in a release build while they are supposed to be used for debugging? Jun 18 2009
On Thu, 18 Jun 2009 13:43:22 -0400, bearophile <bearophileHUGS lycos.com> wrote:Max Samukha:Why would you want to leave asserts in a release build while they are supposed to be used for debugging? Jun 19 2009
Max Samukha Wrote:You have a point. With current dmd, you can include unittests in the release build. So why not asserts? But I don't think it's a good solution to force people who don't want asserts in a final product to prepend each and every assert with 'debug'. For assertions that should stay in production, use 'if' conditions in D1 or std.contracts.enforce in D2. Anyway, it would be nice to have a switch to retain debug assertions in the release build. Jun 19 2009
Christian Kamm Wrote:LDC has the -enable-* and -disable-* command line options for asserts, array bounds checking, invariants and contracts to allow fine grained control over what is emitted and what isn't. Jun 19 2009
On Fri, 19 Jun 2009 05:31:14 -0400, Christian Kamm <see-ldc-commits repository.com> wrote:Max Samukha Wrote:You have a point. With current dmd, you can include unittests in the release build. So why not asserts? But I don't think it's a good solution to force people who don't want asserts in a final product to prepend each and every assert with 'debug'. For assertions that should stay in production, use 'if' conditions in D1 or std.contracts.enforce in D2. Anyway, it would be nice to have a switch to retain debug assertions in the release build. Jun 19 2009
On Thu, 18 Jun 2009 16:57:47 +0400, Qian Xu <quian.xu stud.tu-ilmenau.de> wrote:Jason House wrote:Qian Xu Wrote:Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it will be quite helpful to generate test version and release version of software. Best regards Qian Xu Jun 18 2009
On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu <quian.xu stud.tu-ilmenau.de> wrote:Denis Koroskin wrote:No, they wont. Jun 18 2009
On Thu, Jun 18, 2009 at 8:57 AM, Qian Xu<quian.xu stud.tu-ilmenau.de> wrote:Jason House wrote:Qian Xu Wrote:Hi All, "invariant" is a great language feature of D. But nice thing costs. Is it possible to make it compiler switchable? Like "dmd --ignore-invariant" or "dmd --version=ignore-invariant" It think it will be quite helpful to generate test version and release version of software. Best regards Qian Xu Jun 18 2009
On Thu, 18 Jun 2009 17:46:37 +0400, Max Samukha <outer space.com> wrote:On Thu, 18 Jun 2009 17:12:25 +0400, "Denis Koroskin" <2korden gmail.com> wrote:On Thu, 18 Jun 2009 17:09:12 +0400, Qian Xu <quian.xu stud.tu-ilmenau.de> wrote:Denis Koroskin wrote:No, they wont. Jun 18 2009
Release and Debug are two configuration sets. FEATURE | DEBUG | RELEASE ---------------+-------+--------- assertion | | ---------------+-------+--------- invariant | | ---------------+-------+--------- debug symbols | | ---------------+-------+--------- optimization | | ---------------+-------+--------- inline | | ---------------+-------+--------- more... | | It is also inconvient to switch "invariant" (or debug features) with a universal "-release" flag. Jun 18 2009
Qian Xu Wrote:Release and Debug are two configuration sets. FEATURE | DEBUG | RELEASE ---------------+-------+--------- assertion | | ---------------+-------+--------- invariant | | ---------------+-------+--------- debug symbols | | ---------------+-------+--------- optimization | | ---------------+-------+--------- inline | | ---------------+-------+--------- more... | | It is also inconvient to switch "invariant" (or debug features) with a universal "-release" flag. Jun 18 2009
|