On 2013-08-17 14:36, Jesse Phillips wrote:
Third you've declared a variable, bar, which will store your
enumerated value, 4. Variables are not compile time, even if the
value stored came from a compile time known value.

yep, it completely escaped me that these are 'normal' variables. and i have 
realized now that i can make them known at compile time the same way as is done 
for other 'normal' variables, by declaring them const ;)

pragma( msg, foo ); // why does it print: cast(Test)2

You are referring to a manifest constant, this is a simple textual
replacement. Enumerations are typed, 2 is not a Test, so the compiler
will write out a cast so the type system is happy. Similarly
Test.test2 is not the value of foo, foo is a signal to the compiler
to insert "cast(Test)2."

Hope that makes sense.

things are becoming clearer now. thanks for your explanation, jesse!


/det

Reply via email to