March 14, 2004
Julio Jiménez wrote:

> Lars Ivar Igesund wrote:
> 
>> Lars Ivar Igesund wrote:
>>
>>> Pavel Minayev wrote:
>>>
>>>> The following code (from WinAPI headers) doesn't compile:
>>>>
>>>>     const int SIZE_OF_80387_REGISTERS = 80;
>>>>     ubyte[1 + SIZE_OF_80387_REGISTERS - 1] RegisterArea;
>>>>
>>>> It tells that "integer constant expression" is expected...
>>>>
>>>>
>>>
>>> This still don't work. The spec don't say anything about it, but
>>> 'const int FOO = 1' is certainly an 'integer constant expression'
>>> in my eyes.
>>>
>>> Lars Ivar Igesund
>>>
>>>
>>
>> I'm sorry about the fuzz here, but the bug is there somewhat.
>> What I really did was this:
>> ----------------------
>> array.d
>> ----------------------char [FOO] array;
> 
> const int FOO = 100;
> 
> int main()
> {
>   return 0;
> }
> 
>> char [FOO] array;
>> const int FOO = 100;
>>
>> int main()
>> {
>>   return 0;
>> }
>> ----------------------
>>
>> This don't compile with dmd 0.81 with the message
>> "array.d(1): Integer constant expression expected instead of FOO"
>>
>> If I switch lines 1 and 2, it works. It's a bug IMHO but the
>> workaround is simple.
>>
>> Lars Ivar Igesund
> 
> 
> He He.....
> 
> You are trying to use FOO before define it..... ;-)
> change the lines order to....
> 
> const int FOO = 100;
> char [FOO] array;
> 
> int main()
> {
>   return 0;
> }
> 
> and compiles ok
> 
> regards again...
> 
> Julio
> 

I accept this (and understand) but the error message imply that
the problem is something else than an undefined symbol.

Lars Ivar Igesund
March 15, 2004
I think that D is supposed to allow these types of forward declarations.  Certainly, it allows other types of forward declartions....

Russ

Lars Ivar Igesund wrote:
> I accept this (and understand) but the error message imply that
> the problem is something else than an undefined symbol.
> 
> Lars Ivar Igesund

1 2
Next ›   Last »