[fpc-pascal] Checking if a TStringList already exists

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue May 21 09:50:46 CEST 2019

On 20/05/2019 11:01 pm, Giuliano Colla wrote:
> In some rare case when dealing with complex objects you might need 
> FreeThenNil() in place of FreeAndNil().

As far as I'm concerned, that is such a broken concept! The developer
already has the burden to free any memory that he/she allocates. With
what you are saying, it is now expected from the developer to look at
all source code, flip and coin to decide how complex it is (that will
vary between developers) and then decide which Free(Then|And)Nil()
function to call!?  That should really be left up to the compiler and
should be of no concern to the developer.

Or there is a much simpler answer - the code the developer is working on
is severely broken and needs some refactoring and decoupling of


fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the fpc-pascal mailing list