Tag: delphi
Delphi: Default parameterless constructor
A weird consequence of Delphi’s OOP behavior is how constructors are handled, and in particular how the default parameterless constructor is handled. Consider the following example: [Delphi] type TMyClass = class end; var Obj: TMyClass; begin Obj :=…
Read More »Help Update 1 is out!
Finally, Help Update 1 for RAD Studio 2009 is out. You can read more about it here. Note that there are more fixes and improvements which were not mentioned. Even more are being planned for Help Update 2…
Read More »Out vs Var parameters
All Delphi developers obviously know about the var keyword, otherwise known as “by reference“. Some (although I doubt it) may not know that Delphi has an out keyword also. Both are identical in the fact that both are…
Read More »String results and the weird stuff
There is an interesting particularity to the Delphi compiler. It relates to Strings and Dynamic Arrays. Consider the following two routines: What is the difference between these two routines? Nothing except the syntax. In both cases Result is…
Read More »Delphi 2009 Language features
Check out this link — pretty much details all the new language features added in Delphi 2009. A big thanks goes to Marco Cantu for preparing this document.
Read More »Thread.Synchronize
A general mistake many Delphi developers are making is accessing GUI classes from other threads directly (in a multi-threaded application). It’s a mistake I was doing for a long time. Eventually I started using SendMessage to synchronize with…
Read More »FastMove: Optimizing System.Move
This post describes a technique that can be used to optimize some RTL functions at run-time. At the end of the post there’s a unit; add it to your uses list (preferably as the first one) and the…
Read More »Abstract methods (or “why not”)
I always considered the implementation of abstract methods in Delphi to be a hack, mostly because there is no way (or is there?) to treat this: “[DCC Warning] W1020 Constructing instance of a class containing abstract method.” warning…
Read More »Overridden method should match case of ancestor
I’ve been following CodeRage III these days and presenter mentioned that in Delphi 7 (and above), when overriding virtual methods, the same case should be used for both functions. Consider this example: In this case indeed the compiler…
Read More »Lock keyword (templates)
This is a follow-up on the post about the “Lock keyword” emulation in Delphi. Just created 2 templates that you can use in your Delphi code to speed-up writing: [download#34] [download#35] Drop them into X:\Program Files\CodeGear\RAD Studio\6.0\ObjRepos\Code_Templates\Delphi directory…
Read More »