http://LearnDelphi.tv
In this video Alister Christie looks at the $SCOPEDENUMS compiler directive when using enumerated types.
Amazon Auto Links: No products found.
http://LearnDelphi.tv
In this video Alister Christie looks at the $SCOPEDENUMS compiler directive when using enumerated types.
Amazon Auto Links: No products found.
Author: Alister Christie
2nd half of the demo was a bit suspect imho – you are highly unlikely to save the ord() of an enum member directly. Even if you aren’t saving the enum member *name* (which you should be doing, of course) you are in any event far more likely to save the Ord() of a variable of a specific enum type, and cast back to that same type when loading from storage. Since variables are typed, the scoping issue of one “foot” obscuring another is highly unlikely to occur in the way shown.
@delticsnz I think the point is more that things can go wrong in unusual ways, not that my contrived example is representative of how one should write code in the large. But yes I agree, in most instances Delphi typing will prevent such errors.
lame video. please post something more interesting.