On 5/5/2018 11:32 PM, Lawrence D'Oliveiro wrote:
On Sat, 5 May 2018 19:49:30 +0200, Gregor Mückl wrote:

Please don't create another library that blindly terminates its host
program on a whim.

s/whim/internal consistency failure/


Which is a whim as far as the caller is concerned, isn't it?

Returning an error really is the right thing to do
here. Just make it clear that this is a bad error.

And what exactly is the caller supposed to do about it?


Whatever the hell it pleases to do. I've outlined a few possibilities already. Depending on what the program is for, it may need to do some things even if (or especially because) things went wrong.

Just don't assume that you know better than the creator of the host program when it is okay to bail and how to do so. This is highly dependent on the actual purpose of the program - which you can't assume anything about. It could be a database frontend, a game or a medical device.

The only thing that I could possibly see myself agreeing with is a set of asserts that can be compiled in conditionally in specialized debug builds. So you'd get to break into the debugger if one of these very bad situations happen. A release build should be more optimistic and try to keep running instead, reporting the error.

_______________________________________________
Freetype mailing list
Freetype@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to