Recent

Author Topic: Who catches the Linux signals?  (Read 1753 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5796
  • Compiler Developer
Re: Who catches the Linux signals?
« Reply #15 on: December 12, 2024, 09:10:40 pm »
This takes care of any unexpected error. However at certain places I have divisions. It would be easy to check the divider before the division not to be zero, but in order to take also care should a very large number get divided by a very small number, I rather put it in a try-except

App GTK2 on Linux Deb64.

It is indeed strange that the Try..Except block does not handle division by zero errors. Perhaps using an If..Else statement would be a workaround.

For GTK and Qt the Divide-By-Zero exception is explicitely disabled, because the C (for GTK) and C++ (for Qt) code doesn't handle it either and thus doesn't expect enabled Divide-By-Zero exceptions. These exception masks are per thread.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8084
Re: Who catches the Linux signals?
« Reply #16 on: December 13, 2024, 04:43:45 pm »
App GTK2 on Linux Deb64.

It is indeed strange that the Try..Except block does not handle division by zero errors. Perhaps using an If..Else statement would be a workaround.

For GTK and Qt the Divide-By-Zero exception is explicitely disabled, because the C (for GTK) and C++ (for Qt) code doesn't handle it either and thus doesn't expect enabled Divide-By-Zero exceptions. These exception masks are per thread.

That probably explains a "funny" I saw a few days ago. I was generating a demo waveform (sinc() function) for a digital scope program in a .so, and had a divide-by-zero which was putting a NaN in one position. Somewhat later I applied an FFT and had an NaN in /every/ position... much headscratching ensued.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018