Hints and warnings


Hints
These are a list of some of the ways of improving the performance of code or removing redundant items that eyebol highlights

Using both Is and As together
No events associated with object
Caption is the default
Cursor may be left as busy
Unnecessary PChar casting
Datasource property not set
Dataset property not set in Datasource
Database connected is True
Redundant form data
Page control does not start on first page
Table is active on startup
Hint value exists but ShowHint is false
Use Resources for this string
Improved Date
Inherited not found
Faster reciprocals
Function results ignored
Faster use of sets using Include and Exclude
Faster to check [0] instead of function call to StrLen
Create modal forms using nil – not Application or Self

Warnings
These are a list of potential bugs or issues such as memory leaks and access violations

Object created but not freed
Exit before object is freed
Buttons used in Message Dialog
Bad use of ampersand
Copy out of range
Constructor result not assigned
String property referred to as object
Loop out of bounds
Invalid Format command
Width / Height of form objects
Incorrect FormatDateTime parameter
Listbox Selcount
For Loop count being reduced
Dataset loop condition never met
Notification method in custom components

Various other hints and warnings
Using constant MaxInt instead of call to Length function
  For example : s2:=Copy(s1,5,Length(s1)); is more efficiently written as : s2:=Copy(s1,5,MaxInt);
No need for Copy for only one character (use ‘if Length(s)>=1 then t:=s[1]’, not ‘t:=Copy(s,1,1);’)
AppendStr is for compatibility only
Value returned from function is unused (e.g. use ‘s:=Trim(s);’ as ‘Trim(s)’ by itself does nothing);
Use + instead of Concat
Use StrToIntDef instead of excepts
Use StringOfChar function instead
Use SameText here for comparing strings without case sensitivity
Use AnsiSameText here for comparing strings
Use Odd instead of Mod 2
Use Mod in place of calculation
Range will always return false (e.g. if (s[1]>’z’) and (s[1]<’a’) …)
Parameters probably wrong way round in Pos function
Use SetLength instead (For example: use SetLength(s,Length(s)-1); instead of s:=Copy(s,1,Length(s)-1);)
Use Active:=True instead of Open (for datasets)
  Open is only a wrapper for Active:=True
Use Active:=False instead of Close (for datasets)
  Close is only a wrapper for Active:=False
Use SetLength instead of [0] (e.g. use ‘SetLength(s,10);’ as ‘s[0]:=10;’);