final variables

#ponce aliloko at gmail.com
Tue Sep 22 02:30:29 PDT 2009


> Strange, I cannot compile both of your examples in D2.032 without 
> getting "final cannot be applied to variable".

Ok I was using D1.
Final for variables must have been removed.

> const work just fine in D and even better than C's const in my opinion. 
> I like being able to declare only a part of a type as const, such as 
> const(int)[], const(void)* or const(immutable(char)[])[]. I cannot tell 
> about D1's const however, its been so long since I last used it.

What I understand is that D1's const force compile-time evaluation whereas D2's don't. Not sure though.


More information about the Digitalmars-d-learn mailing list