Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2017-04

Object checks

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

C Western

If I may, a couple of queries about code generated for object checking when range checks are on (-Cr):

An explicit check for nil is generated, which seems redundant, as any attempt to use the value will generate a SIGSEGV anyway on most platforms, or am I missing something?

If the fpc_check_object fails it calls RunError, which forces the application to terminate, whereas a SIGSEGV will raise an exception and give the user the option of continuing (at least in an LCL app). Is there any reason why fpc_check_object does not call HandleError?

Colin

Reply by email

Pierre Muller
to C Western

Hi Colin,

C Western wrote 11 lines
If I may, a couple of queries about code generated for object checking when range checks are on (-Cr): An explicit check for nil is generated, which seems redundant, as any attempt to use the value will generate a SIGSEGV anyway on most platforms, or am I missing something? If the fpc_check_object fails it calls RunError, which forces the application to terminate, whereas a SIGSEGV will raise an exception and give the user the option of continuing (at least in an LCL app). Is there any reason why fpc_check_object does not call HandleError?

Thanks for the suggestion,

I applied a patch in commit 36113 to trunk that
substitutes RunError with HandleError.
It has been applied to three functions:
fpc_help_destructor, fpc_check_object and fpc_check_object_ext

Pierre

Reply by email

C Western
to Pierre Muller
Pierre Muller wrote 6 lines
I applied a patch in commit 36113 to trunk that substitutes RunError with HandleError. It has been applied to three functions: fpc_help_destructor, fpc_check_object and fpc_check_object_ext

Thank you for doing this. In the meantime I put a slightly updated patch in 31745 in the bug tracker, which gives slightly better stack traces.

Colin

Reply by email

Pierre Muller
to C Western
C Western wrote 9 lines
On 05/05/17 12:54, Pierre Muller wrote: > > I applied a patch in commit 36113 to trunk that > substitutes RunError with HandleError. > It has been applied to three functions: > fpc_help_destructor, fpc_check_object and fpc_check_object_ext > Thank you for doing this. In the meantime I put a slightly updated patch in 31745 in the bug tracker, which gives slightly better stack traces.

Hi Colin,

thanks for this improvement,
I committed it in rev 36134.

Pierre

Reply by email