Month: November 2008
String reverse tests
This post will be a short one. Just giving a general recommendation for people doing String processing in Delphi – use PChar or ^Char for that. I have made a simple test program that reverses a very big…
Read More »Strings, PChars and reference counting
Hi folks, in today’s post I will continue with reference counting specifics of Delphi in the particular case of Strings. We’ll start with a small example: What will the output of this program be? The obvious result (the…
Read More »C++ Builder TypeInfo alternative.
I bet most Delphi developers know about TypeInfo operator. It provides type information somehow similar to reflection in Java or .NET (of course a lot more limited). Take this simple example: It will simply write “Byte” on the…
Read More »That stupid garbage collector
I’ve heard this phrase a few times in regards to Delphi’s reference counting mechanics. Before continuing with this post please note — Delphi doesn’t have a Garbage Collector (as Java or .NET)! It uses Reference Counting as part…
Read More »Delphi 2009: reference to
It’s probably not news anymore but Delphi 2009 supports anonymous methods out of the box. To be able to support them, CodeGear developers added a new type of a “pointer to a method” called a managed method reference:…
Read More »Generics.Defaults: Bug
There is a bug in Generics.Defaults unit in Delphi 2009. If you read my previous post: Generic Defaults you should know already about the “3 bytes long” data types and how are those passed as const parameters to…
Read More »Generic Defaults
One important part of any generic collection classes are the “type support” functions. And what I mean are the functions specific to each type that perform: Comparison – will return a value indicating if A > B or…
Read More »Delphi 2009 – Exit;
A very useful and cool feature in Delphi 2009 is the Exit keyword. Yes, it’s that Exit that “returns” from a function call. So what’s so exiting about it? Nothing really – for people coming from C-like languages,…
Read More »Delphi Generics: Problem 1
Kids, don’t try this at home 🙂 Error: [DCC Fatal Error] Tests.DynamicArray.pas(772): F2084 Internal Error: URW1135 There you have it 🙂 The fix is rather simple but annoying: Declare a new type in the class/record like this: And…
Read More »TSendMail Action
If you’ve ever wondered how to use TSendMail action in ExtActns unit – drop it, it’s useless. I’ve had a few people complaining they don’t know how to set the Recipients and Subject set it – you can’t…
Read More »