String property referred to as object

It is valid syntax to cast a string as an object but this can often be an unintended mistake.

For example:

MenuItem:=TMenuItem(strlist[0]); //where strlist is a TStringList

The programmer probably did not mean to refer to the string property of the stringlist but the object property like this:

MenuItem:=TMenuItem(strlist.objects[0]);

eyebol will produce a warning when it believes this is the case.


< Back to list of hints and warnings