|
|
Subscribe / Log in / New account

GMP and assert()

GMP and assert()

Posted Feb 28, 2019 15:50 UTC (Thu) by intgr (subscriber, #39733)
In reply to: GMP and assert() by NAR
Parent article: GMP and assert()

> calling assert() in a library is just cop-out from a proper error handling

There are some frameworks that handle assertion failures by logging and returning: GNOME things like glib, GTK, etc.

Have you ever tried running a GNOME application in a terminal? The majority of them spew errors and warnings left and right; developers seem to just ignore the errors because they are so easy to ignore. No-one bothers reporting them as bugs, although many of them probably are.

As far as I can tell, the whole industry has been slowly moving towards a more "fail fast, fail loud" approach. I'm surprised that it has suddenly became controversial.


to post comments

GMP and assert()

Posted Feb 28, 2019 16:41 UTC (Thu) by NAR (subscriber, #1313) [Link] (3 responses)

If the glib, gtk would instead crash, nobody bothered to use them in the first place.

GMP and assert()

Posted Feb 28, 2019 20:15 UTC (Thu) by mageta (subscriber, #89696) [Link] (1 responses)

But they do, errors in glib always crash the entire process.

GMP and assert()

Posted Mar 3, 2019 13:41 UTC (Sun) by hadess (subscriber, #24252) [Link]

> But they do, errors in glib always crash the entire process.

There are 2 type of "errors" that crash the entire process in a GLib program: a call to g_error(), and memory allocation failure. Both of those are documented.

GMP and assert()

Posted Mar 1, 2019 18:31 UTC (Fri) by notriddle (subscriber, #130608) [Link]

Bull. If the application crashed instead of launching, it would never have been released. It probably would never have been uploaded to version control.

GMP and assert()

Posted Mar 3, 2019 13:45 UTC (Sun) by hadess (subscriber, #24252) [Link]

> Have you ever tried running a GNOME application in a terminal? The majority of them spew errors and warnings left and right; developers seem to just ignore the errors because they are so easy to ignore. No-one bothers reporting them as bugs, although many of them probably are.

They're easy to ignore because most "GNOME applications" aren't launched from a terminal and people rarely read all the errors in the journal when apps otherwise function.

And application developers are thankful for the bug reports, when they happen.

Note that if you feel courageous, you could set "G_DEBUG=fatal_warnings" and all the warnings would make the app crash. Send backtraces!


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