Thread overview |
---|
September 15, 2014 version assignment and module scope | ||||
---|---|---|---|---|
| ||||
I'm a bit baffled why using something like this doesn't get recognized by imported modules: version = Unicode; I use this to try and alter the way the win32 API headers resolve certain symbols, but currently the only way to force that version symbol to be recognized correctly is to define it on the compiler command-line. Is there some alternative to doing this? I thought this was one way to emulate the C "#define" type of conditional compilation, but it appears that anything outside of the current module is unaffected by version assignments like the above. Could this be considered a defect of design? Thanks! |
September 15, 2014 Re: version assignment and module scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dcrepid Attachments: | On Mon, 15 Sep 2014 21:26:27 +0000 dcrepid via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > Could this be considered a defect of design? no. it works the way it's intended to work. given that order of module imports is not defined (i.e. reordering imports should not affect resulting code), making 'version=' propagating to other modules will create disasterous side effects, even weirder than C macro abusing. "#define" is BAD, but in C you can at least control order of imports. in D you can't, so making 'version=' affect other modules will turn everything to hellish nightmare. |
September 15, 2014 Re: version assignment and module scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | > no. it works the way it's intended to work. given that order of module
> imports is not defined (i.e. reordering imports should not affect
> resulting code), making 'version=' propagating to other modules will
> create disasterous side effects, even weirder than C macro abusing.
Okay, thanks for the explanation. I hadn't considered that putting a version assignment between imports, but I see how that can become an issue.
|
Copyright © 1999-2021 by the D Language Foundation