Demystifying pointers in Delphi

Having a general understanding of how memory and addressing works, helps you understand pointers in Delphi (and C/C++). Learning assembler also gives you that knowledge, but there are simpler ways to think about it.

A pointer is a memory location that contains the address to the actual data you want.

Think of a street with houses. Make a list of the houses and their addresses.
This is a list of pointers. Each pointer in the list leads to the actual house it refers to.

Continue reading “Demystifying pointers in Delphi”

Generic Command Line Parser for Delphi 10.3.x

You know the feeling. You need a specific input from your command line, but you can’t find something lightweight that does the job. Hence, the FDC.CommandLine was born.

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

You can use – / or + as a switch, and use : or = as a flag for parameters.

You can use single and double quotes to be able to parse parameters that contain spaces and quotes.
/quoteoftheday:”This is a ‘quoted’ parameter”

It also supports lists of parameters.
/inputfiles:(file1.txt , “file with space.txt”)

Take a look at the TestFDCCommandLine.dpr for more examples of how it works.

Continue reading “Generic Command Line Parser for Delphi 10.3.x”

Delphi pitfalls: Enumerated types and for loops

Not all for loops are created equal.

for x in [value1, value2, value3]

You would expect to see x vary in the order of the values in the list.

However – if x and the values are of an enumerated type, looping the “list”
does NOT loop in the apparent order of the constant, but in the order of the enumerated type declaration, such as it would for any set.

Continue reading “Delphi pitfalls: Enumerated types and for loops”

Delphi: Pitfalls of Anonymous methods and Capture

I was writing a web request handler when I ran into a problem. I was plugging in multiple handlers, but only one of them actually worked.


To get to the essence of it, this doesn’t work

procedure TMyClass.Setup;
  Handler: THandlerClass;
  hType: THandlers;
  for hType in [foo, bar]
  do begin
    case hType of
      foo: Handler := TFoo.Create;
      bar: Handler := TBar.Create;

Zipped example source code:

Continue reading “Delphi: Pitfalls of Anonymous methods and Capture”

Delphi Developers Archive (Experimental)

Delphi Developers Archive (Experimental)


The posts are searchable by tag list or free text search.


FYI – This is work in progress, and I hope to improve the following issues:

– Some posts have erroneous titles

– Some posts are missing attribution of the original poster

– Some 600 posts are missing due to an inexplicable quota error during import


Comments on the archived posts are currently disabled until the import is finalized.