version and extern problems
Bill Baxter
dnewsgroup at billbaxter.com
Wed Jul 11 01:52:38 PDT 2007
0ffh wrote:
> nonnymouse wrote:
>> Surely that's just an "x is not defined on line 2" error?
>
> Nope. This, for example, is a perfectly valid D programme:
>
> ---<snip>---
> module test;
>
> int y=3+x;
> const int x=5;
>
> void main()
> {
> printf("x=%i y=%i\n",x,y);
> }
> ---<snap>---
>
> Seems like D collects all declarations first, unlike C.
>
> Regards, Frank
The snippet you snipped was:
const string x = "abc" ~ foo;
const string foo = x[1..4];
So more like
const int y=3+x;
const int x=5+y;
No matter which order you scan that, you can't come to a valid order of
initialization.
--bb
More information about the Digitalmars-d
mailing list