www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DUSE_MYLIB12

reply "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
Tell me, please, is it possible to set an arbitrary condition 
conditional compilation at the command prompt, type DUSE_MYLIB12 
and in the code as:

version(USE_MYLIB12) {
        .....
}

And I didn't like Any DeclarationBlock or Statement that is not 
compiled in still must be syntactically correct:
http://dlang.org/version.html

It may be that using an optional library code is correct, and 
without it not?
Feb 11 2015
parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Wednesday, 11 February 2015 at 11:26:20 UTC, Dennis Ritchie 
wrote:
 Tell me, please, is it possible to set an arbitrary condition 
 conditional compilation at the command prompt, type 
 DUSE_MYLIB12 and in the code as:

 version(USE_MYLIB12) {
        .....
 }
Specify -version=USE_MYLIB12 on the command line.
 And I didn't like Any DeclarationBlock or Statement that is not 
 compiled in still must be syntactically correct:
 http://dlang.org/version.html

 It may be that using an optional library code is correct, and 
 without it not?
No, that's not possible. Syntactically correct != semantically correct. It just means that the syntax rules of the language are respected, e.g. parens must be correctly nested (no [} or something like that). Since D libraries can't affect the syntax of the language, no code can be syntactically correct only in that library's presence.
Feb 11 2015
parent "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
Thanks.
Feb 11 2015