[fpc-pascal] If an Assert fails in constructor, then destructor called (?)

Tom Verhoeff T.Verhoeff at tue.nl
Thu Jul 2 12:20:07 CEST 2009


On Wed, Jul 01, 2009 at 01:15:29PM +0200, Michael Van Canneyt wrote:
> On Wed, 1 Jul 2009, Tom Verhoeff wrote:
>>
>> Zoiets zou ook in de TObject.Create (RTL) doc. van FreePascal passen
>> (lees: thuishoren).
>
> For non-dutch speakers: It says that this kind of information should
> be included in the FPC documentation. I will do so. But in my opinion,
> it does not belong in the unit reference documentation, but in the language
> documentation.

My apologies for the Dutch part (I got interrupted when writing the message).
The translation is OK :-)

I have looked in the Language Reference Guide to see where it would
be appropriate to include this information.

Section 6.2 is about Class instantiation, using a constructor.

I have no idea how the exception mechanism in constructors is actually
implemented.  Does it have anything to do with TObject, or is it
completely independent of that?

I did not find a discussion about the distinctions between the
various kinds of methods (function, procedure, constructor, destructor).
They are just named (syntactically) in 6.3.1 Classes > Methods > Declaration.

In particular, the issue concerns both constructors as well as the destructor.

For constructors it is important to realize what the consequences
will be when they are interrupted with an exception.
For destructors it is important to keep in mind what one may or may not
assume when they are called.

Best regards,

	Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL     | Dept. of Math. & Comp. Science
PHONE:  +31 40 247 41 25        | Technische Universiteit Eindhoven
FAX:    +31 40 247 54 04        | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands



More information about the fpc-pascal mailing list