[DUG] Related try..finally question
Phil Middlemiss
phil at tumonz.co.nz
Mon Jul 24 08:28:17 NZST 2006
Makes you wonder why they didn't make the compiler just initialise all
local pointer variables to null to start with! Or for that matter, all
numeric values to 0 too.
Phil.
Todd Martin wrote:
> Not if x is initialised x:=nil; before the try block.
>
> ----- Original Message ----- From: "Alister Christie"
> <alister at salespartner.co.nz>
> To: "NZ Borland Developers Group - Delphi List" <delphi at ns3.123.co.nz>
> Sent: Friday, July 21, 2006 4:39 PM
> Subject: Re: [DUG] Related try..finally question
>
>
>> Exceptions can be generated in constructors as well.
>> so
>> try
>> x := Tobj.Create; //an exception could occur here
>> finally
>> x.free;//this is now a programming error
>> end;
>>
>>
>> Alister Christie
>> Computers for People
>> Ph: 04 471 1849 Fax: 04 471 1266
>> http://www.salespartner.co.nz
>> PO Box 13085
>> Johnsonville
>> Wellington
>>
>>
>> Todd Martin wrote:
>>> Agreed. The idea that an object raises an exception in its
>>> destructor is mind boggling.
>>>
>> _______________________________________________
>> Delphi mailing list
>> Delphi at ns3.123.co.nz
>> http://ns3.123.co.nz/mailman/listinfo/delphi
>>
>>
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.394 / Virus Database: 268.10.3/394 - Release Date:
>> 20/07/2006
>>
>>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phil.vcf
Type: text/x-vcard
Size: 250 bytes
Desc: not available
Url : http://ns3.123.co.nz/pipermail/delphi/attachments/20060724/7227f60e/phil.vcf
More information about the Delphi
mailing list