[Github-comments] [geany/geany-plugins] Use "g_return_val_if_fail()" instead of producing an own error message. (109b8d0)

Colomban Wendling notifications at xxxxx
Sat Aug 19 23:32:35 UTC 2017


@elextr I find it pertinent to use these macros when they are meant to detect programming errors.  Yes, you can be forcefully defensive and always check no matter the debugging status, but the point these macros can be disabled (although in practice most builders don't disable them anyway) is for one to be able to trade safety for more speed.

So IMO if a builder do want to disable those checks, fine, but they gotta know it's less defensive.  Which could make sense, as these checks are for programming errors, and should not depend on user behavior.

In all cases, I think using a GError for programming error is worse than emitting a warning somewhere, because it's harder to handle the error and it could be ignored and left unnoticed more easily.

>Your documentation for the function doesn't disallow NULL

It odes, unless you accept `NULL` to be valid for *The project*, and as the function is supposed to save it to a file, I wouldn't expect `NULL` to be a valid one unless explicitly stated otherwise.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/commit/109b8d079a59ba35e8aba5da960fc5b10f03ea7f#commitcomment-23747113
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170819/3c6fadaf/attachment.html>


More information about the Github-comments mailing list