Article

From:
To:
Rudy Velthuis (TeamB)
Subject:
Re: FreeAndNil is often sign of wrong design - did anyone really readthe blog? [Edit] [Edit]
Newsgroup:
embarcadero.public.delphi.language.delphi.general

Re: FreeAndNil is often sign of wrong design - did anyone really readthe blog? [Edit] [Edit]

"Rudy Velthuis (TeamB)" <✉rvelthuis.de> wrote in message 
news:✉forums.codegear.com...
> Well, your design will, of course, have to prevent that too. That means
> that there is only one reference (except for local copies of the
> reference, which disappear when the routine ends), and that is not
> freed before it can be freed, i.e. not as long as it is accessible.
> Follow that maxim and you can't access freed objects.

And since when is everybody following the rules a given?

I prefer not to rely just on the rules, but to enforce them by any strategies at my disposal. Compile time, or runtime. Even automated test time. One of our "todo's" currently is some automated tests to enforce several "rules" that are needed to ensure that a couple of fixes for compiler "bugs" are always used instead of the standard code... (Which by the way can't be done with "normal" unit testing as it the fixes are in separate units which themselves are of course tested using unit tests. For example we need to ensure that our IniClasses unit is used and not the standard IniFiles. The rule that needs testing is that IniFiles is only used in our IniClasses unit and nowhere else). -- Marjan Venema
Edited by: Marjan Venema on Feb 22, 2010 9:32 AM
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Wed, 08 May 2024 03:33:46 UTC
Copyright © 2009-2024
HREF Tools Corp.