On 24/02/2019 17:23, Ryan Joseph wrote:


On Feb 24, 2019, at 10:48 AM, Jonas Maebe <jo...@freepascal.org> wrote:


It's is an inherent part of the "class" feature. Without it, any exception that 
gets thrown in a constructor (or in any code called by a constructor) will cause memory 
leaks.

Not very useful if we don’t use exceptions though. :) I still don’t understand 
why exceptions aren’t enabled with a mode switch like advanced records or type 
helpers especially considering everyone that uses classes is now paying a price 
for it (without even knowing!).

Many routines in standard units can raise exceptions. If you use the sysutils unit anywhere, any run time error is also converted into an exception. It's an inherent part of the language and RTL. This is not C++ where the language tries to be both assembler and lisp at the same time.

How can I test to verify if this works or not?

Throw an exception in a constructor, compile with -gh and notice you got yourself a memory leak.

Martin makes it sound like there’s some other considerations for subclasses.

That is not what he said.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to