Posted by Warwick Weston Wright on August 01, 2007
I was recently writing code using a list of 10 enumerated constants the declaration had the following code Type STTypes=(ST64BitInteger,.....);and the following line of code caused a compile time error 'incompatible types'
if ST64BitInteger=FrmNewTbl.FrmCreateNewTbl.CmbType.ItemIndex then begin .... End; etc;
in this instance I replaced the enumerated declaration with a simple constant definition as follows;
const ST64BitInteger=0 and the program compiled & worked also if I substituted the ST64BitInteger with a literal 0 it also worked.
The Question is. Are enumerated types in Delphi 2007 treated as constants or is there a bug in the language because my extensive programming experience with many languages has taught me that enumerated types and constants are exactly the same thing as literal values. Or are enumerated types actually designed for a different purpose in Delphi & if so what is this purpose. Personally I think it's a bug.
Related articles
Follow Ups
Post a Followup
DelphiLand Club members: enter your Membership password.
Guests can get a Forum Guest password by subscribing to the DelphiLand Newsletter.