|
|
Subscribe / Log in / New account

error codes and asserts have different purposes.

error codes and asserts have different purposes.

Posted Mar 22, 2019 0:40 UTC (Fri) by mcortese (guest, #52099)
In reply to: error codes and asserts have different purposes. by john.carter
Parent article: GMP and assert()

> Divide by zero, dereference null.... do you want the CPU to ignore those errors and just womble on doing stupider and stupider things.... sometimes working, sometimes doing rubbish, sometimes dying?

Ideally I'd like the application to degrade in a localized and controlled way. For example, if the battery applet on my panel, which calculates the % of charge dividing the current charge by the max capacity, faces a divide-by-zero for whatever reason (say, a hardware failure of the battery control), it could simply show 0% or 100% or even a meaningless value, and yet this would be ways better than killing the whole panel[1].

So yes, sometimes wombling on doing stupider and stupider things is the desirable approach.

[1] In fact, this is not a made-up example but a real case with LXDE panel.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds