Posts

Showing posts with the label StrToIntDef

Best practice to prevent Bugs and Exceptions during coding in Delphi

To develop a good application it needs to be bug free and as a good developer we need to code in best to prevent Bugs and Exception that may be raise during application run. So here in this blog I have pointed some steps for best coding practice. 1.  Hints and Warnings Solve all hints and warnings that shows during compile and build of an application in Delphi IDE.  The warnings marked by Delphi can really cause some errors in runtime. 2. Items of lists Never access items of a list without being sure that the item really exists in that list or not freed. Example if objText.Count > 10 then strText := objText.Strings[10]; 3. Pointers to objects Use the Assign function to check if an object is still assigned to a pointer. When freeing the object, also make sure the pointer is set to nil. Example if Assigned(objText) then intCount := objText.Count; FreeAndNil(objText); 4. Using of Try - Finally Always use a try-finally structure where you have to be s...