digitalmars.D - version dependence check
- Shawn Liu (29/29) Aug 08 2005 see the code below:
- Shawn Liu (5/13) Aug 08 2005 we can copy the content of "versionctrl.d" to the top of the "test.d" to...
- Ben Hinkle (4/21) Aug 08 2005 Pass the version info to the compiler at the command-line. Version
- Shawn Liu (27/34) Aug 08 2005 see the example from D page,
- Derek Parnell (9/45) Aug 08 2005 Sounds like an enhancement I could make to Build...
see the code below: // file: versionctrl.d module versionctrl; version(ANSI){ }else{ // want to use unicode as default version = UNICODE; } // file: test.d module test; import versionctrl; class Test{ version(ANSI){ void foo(){ printf("Ansi version\n");} } version(UNICODE){ void foo(){ printf("Unicode version\n");} } } void main(){ Test t = new Test(); t.foo(); } // compiled with no version set, Unicode desired dmd versionctrl.d test.d test.d(16): no property 'foo' for type 'test.Test' test.d(16): function expected before (), not 1 of type int // it seems that DMD didn't check the version for // versionctrl.d though it is imported by test.d
Aug 08 2005
In article <dd73ap$1t2f$1 digitaldaemon.com>, Shawn Liu says...see the code below: // file: versionctrl.d module versionctrl; version(ANSI){ }else{ // want to use unicode as default version = UNICODE; }we can copy the content of "versionctrl.d" to the top of the "test.d" to solve this. but copy hundreds of this content in a big project is annoying. Can we just import the "versionctrl"?
Aug 08 2005
"Shawn Liu" <Shawn_member pathlink.com> wrote in message news:dd74t8$1umg$1 digitaldaemon.com...In article <dd73ap$1t2f$1 digitaldaemon.com>, Shawn Liu says...Pass the version info to the compiler at the command-line. Version statements only affect the module in which they live.see the code below: // file: versionctrl.d module versionctrl; version(ANSI){ }else{ // want to use unicode as default version = UNICODE; }we can copy the content of "versionctrl.d" to the top of the "test.d" to solve this. but copy hundreds of this content in a big project is annoying. Can we just import the "versionctrl"?
Aug 08 2005
see the example from D page, http://www.digitalmars.com/d/version.html#version version (ProfessionalEdition) { version = FeatureA; version = FeatureB; version = FeatureC; } version (HomeEdition) { version = FeatureA; } ... version (FeatureB) { ... implement Feature B ... } Suppose we have several files (maybe hundreds of files) in a project, we have to copy above code into EVERY file. Otherwise the code inside version(FeatureB) will not be compiled. Another way is passing "-version=FeatureB -version = FeatureC" to the compiler as you said. If so, the "version = ???" feature seems useless. This is far different from C. If we define some thing in previous h file, the current file will inherit those feature when the previous file is included. "Ben Hinkle" <ben.hinkle gmail.com> wrote:dd7hlg$2an2$1 digitaldaemon.com..."Shawn Liu" <Shawn_member pathlink.com> wrote in message news:dd74t8$1umg$1 digitaldaemon.com...In article <dd73ap$1t2f$1 digitaldaemon.com>, Shawn Liu says...Pass the version info to the compiler at the command-line. Version statements only affect the module in which they live.
Aug 08 2005
On Tue, 9 Aug 2005 00:16:07 +0800, Shawn Liu wrote:see the example from D page, http://www.digitalmars.com/d/version.html#version version (ProfessionalEdition) { version = FeatureA; version = FeatureB; version = FeatureC; } version (HomeEdition) { version = FeatureA; } ... version (FeatureB) { ... implement Feature B ... } Suppose we have several files (maybe hundreds of files) in a project, we have to copy above code into EVERY file. Otherwise the code inside version(FeatureB) will not be compiled. Another way is passing "-version=FeatureB -version = FeatureC" to the compiler as you said. If so, the "version = ???" feature seems useless. This is far different from C. If we define some thing in previous h file, the current file will inherit those feature when the previous file is included.Sounds like an enhancement I could make to Build... version(build) pragma(export_version, "FeatureB"); to place "-version=FeatureB" on the dmd command line automatically for you. Something like that anyway. What do you guys think? -- Derek Parnell Melbourne, Australia 9/08/2005 2:27:04 AM
Aug 08 2005