Why does this work?
Vladimir Panteleev
vladimir at thecybershadow.net
Thu Feb 17 21:23:26 PST 2011
On Fri, 18 Feb 2011 07:06:26 +0200, Jason House
<jason.james.house at gmail.com> wrote:
> I would have expected bar to equal 2 since foo would be default
> initialized to 2. I'm going to guess that the there's some kind of
> optimization that only assigns to foo once and isn't noticing that bar
> depends on it.
Nope:
int foo;
enum bar = foo+2;
void main()
{
foo = 7;
assert(bar == 9);
foo++;
assert(bar == 10);
}
> You should probably post that in bugzilla.
And complain about basically having expression macros?!
--
Best regards,
Vladimir mailto:vladimir at thecybershadow.net
More information about the Digitalmars-d
mailing list