Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
$720 in referrals so far!

About/Contact

Steve Trefethen

Steve Trefethen is a Software Architect and Director of Software Training at Falafel Software in Capitola, CA. You can reach Steve here.

All opinions you read here are Steve's own and are not necessarily those of Falafel Software.

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
If you're new here, you may want to subscribe to my RSS feed, follow me on Twitter, or subscribe via email. Thanks for visiting!

Delphi RTL and Language Wisdom

June 26 2007 4:34PM

It's Tuesday and following up my VCL list from yesterday, here my list for the RTL and Object Pascal language:

  • Learn to create your own TList descendants
  • Learn to write your own TCollection/TCollectionItem descendants
  • Use Format
  • Learn TThread then, understand TThread.Synchronize
  • Use TFileStream, TStringStream, TMemoryStream
  • Learn how to use the classes in SyncObjs.pas
  • Learn to call a function from a dynamically loaded DLL
  • Use exceptions
  • Learn when to use stdcall
  • Learn to use open array parameters
  • Use the *utils.pas units, DateUtils, StrUtils, MaskUtils, ConvUtils, VarUtils etc.
  • Learn the Math unit
  • Use SafeMM
  • Learn which exceptions the RTL throws
  • Use try...finally
  • Read the comments in SysUtils.pas
  • Call FindClose after calling FindFirst
  • Learn how to load packages dynamically
  • Use FindCmdLineSwitch
  • Just because it's not in Windows.pas doesn't mean it can't be called from Delphi
  • Learn function inlining
  • Be careful using "with"
  • Learn to use interfaces
  • Use dynamic arrays
  • Read the Language Reference manual
What am I missing?
FacebookDel.icio.usDigg It!

Tags:

Comments

6/26/2007 7:28:50 PM #

Where can I get SafeMM?

Sebastian Zierer |

6/27/2007 1:37:47 AM #

First: always use FreeAndNil(X) instead of X.Free.

Second, the biggest single time-saver for me is my own TMonitoredObject class.  It inherits from TObject, but adds a sequential ID number for each instance.  If I $DEFINE DEBUG, the constructor and destructor each write a log entry indicating that they've been called, along with the actual class name and ID number.  At the end of a program run, the unit that defines TMonitoredObject gives me a list of any objects that haven't been freed.  It also tracks double-freeing, although that's less of an issue if you use FreeAndNil.  Just insure you always use type TFoo = class(TMonitoredObject) instead of TFoo = class, and you're set.  In one fell swoop, it makes memory leaks virtually impossible.  I can stick a copy up somewhere if you want to see it, but it's pretty easy to produce just from that description.

Eric TF Bat |

6/27/2007 3:20:23 PM #

Sebastian,
Ben Taylor did work on SafeMM though I can't find much about it on the web. I'll dig up what I have about it and get it posted. We use it here to help strictly with memory leak detection.

Steve Trefethen |

Comments are closed