help with c translation

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Jul 2 09:43:29 PDT 2009


BCS wrote:
> Hello Ary,
> 
>> Well, it should work! const means, once a value is assigned to that
>> variable, it never changes again. The compiler can do static analysis
>> to verify this. And that's why it works. And that's why D should also
>> work this way, IMHO.
>>
> 
> In D1, const is truly const, as in never changes, ever, not even from 
> one run of the program to another. D2 keeps this idea but IIRC calls it 
> something else.
> 
> 

In D2 you use enum for that, I think. The contents of const and 
invariant variables can both be set at run time, whereas enums must be 
known at compile time.

-Lars


More information about the Digitalmars-d-learn mailing list