Version bug?
Jonathan M Davis
jmdavisprog at gmail.com
Fri Aug 20 17:08:22 PDT 2010
On Friday, August 20, 2010 16:49:38 Adam Ruppe wrote:
> I just hit something that might be a compiler bug, or might be a
> documentation bug. (Of course, it can't be me! :P )
>
> I have two modules:
>
> config.d
> ===
> version (clientA) {}
>
> version ( clientB ) {
> version = withFeatureX;
> }
>
> version (clientC) {
> version = withFeatureX;
> }
> ===
>
> application.d
> ===
> import config;
> void main() {
> version(withFeatureX)
> static assert(0);
> }
> ====
>
>
> dmd application.d config.d -version=clientB
>
> This compiles, but I expect it to hit the static assert.
>
> Should it? Note that it does work correctly if I put the version= line
> in the actual file, but that means I can't have the nice centralized
> config module anymore.
>
> So is this a bug, or should the documentation be a bit more explicit
> about version = lines only working inside the one module? (or should I
> just learn how to read? :-P)
>
> I kinda miss #include here.....
As I understand it, version is supposed to be set for the whole build, and
you're not supposed to be able to change it, but it might be meant to be
changeable on a per-module basis. Certainly, I wouldn't expect you to set it in
one module and have it affect another. That would create extra dependencies,
which D generally avoids as much as possible. I'd have to pull out my copy of
TDPL though if I wanted to say for sure how setting version is supposed to work.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list