Version bug?
Adam Ruppe
destructionator at gmail.com
Fri Aug 20 16:55:37 PDT 2010
If this behavior is by design, I suggest changing this sentence:
http://www.digitalmars.com/d/2.0/version.html
"Version identifiers defined in one module have no influence over
other imported modules."
To
"Version identifiers defined in one module have no influence over
other modules."
Striking the word "imported", since it being there implies it only
changes modules the defining file imports - a one way thing. This lack
of influence would in fact go both ways.
On 8/20/10, Adam Ruppe <destructionator at gmail.com> 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.....
>
More information about the Digitalmars-d
mailing list