Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 20, 2005 Conditional Compilation, Version Condition | ||||
---|---|---|---|---|
| ||||
I found that no elegant way to express in D somthing like this: #if(VerA>=4) // do somethig #endif #if(VerA>=3) // do somethig #endif #if(VerB>=2) // do somethig #endif I can write: version(VerA_4) { version=VerA_3; version=VerA_2;} version(VerA_3) { version=VerA_2;} version(VerB_4) { version=VerB_3; version=VerB_2;} version(VerB_3) { version=VerB_2;} version(VerA_4) {/*do somethig*/} version(VerA_3) {/*do somethig*/} version(VerB_2) {/*do somethig*/} But what will be if I need VerA_10? I think it is possible to introduce somthing like this: version=VerA,4; version(VerA,4) { /*do somethig*/ } -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
October 24, 2005 Re: Conditional Compilation, Version Condition | ||||
---|---|---|---|---|
| ||||
Posted in reply to Artem Rebrov | The other way to reach the same result is to write static if in global scope. Do somebody have any ideas about it? On Thu, 20 Oct 2005 23:20:50 +0400, Artem Rebrov <ar_other@mail.ru> wrote: > I found that no elegant way to express in D somthing like this: > > #if(VerA>=4) > // do somethig > #endif > > #if(VerA>=3) > // do somethig > #endif > > #if(VerB>=2) > // do somethig > #endif > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
October 25, 2005 Re: Conditional Compilation, Version Condition | ||||
---|---|---|---|---|
| ||||
Posted in reply to Artem Rebrov | I think you can do this: version(v5) { bla } else version(v4) { bla } else version(v3) { bla } Does that suit ya? |
October 30, 2005 Re: Conditional Compilation, Version Condition | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan | On Wed, 26 Oct 2005 03:42:00 +0400, Dan <Dan_member@pathlink.com> wrote: > I think you can do this: > > version(v5) > { > bla > } > else version(v4) > { > bla > } > else version(v3) > { > bla > } > > Does that suit ya? In this case I must write something like this: version(v5) { int k; int j; int i; } else version(v4) { int j; int i; } else version(v3) { int i; } -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
Copyright © 1999-2021 by the D Language Foundation