-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete refactor #265
Delete refactor #265
Conversation
to return void if possible and not crash if called with NULL
return value was ignored anyway
fix build
@mawe42 Need a second opinion. This PR ought to refactor (nearly) all destructor functions to return void if possible and make them safe when called with NULL. For consistency I used |
Well, it seems like g_return_if_fail is a custom assertion defined by glib. So all code using
So if your aim is to make the code safe, then using something that can be disabled by a compile-time switch is not really suitable, IMHO. |
But I think that doesn't quite answer your question. I really like the simple and explicit
But I don't like that fact that these types of checks take such a large amount of vertical space when using Allman style braces. 5 lines of code for a single check (if you also add an empty line between)... and when you need two or three of these, then a lot of your screen is taken up by that code. I personally would like either single line checks:
or using a macro, but with an easier to understand logic:
|
I understand your point. On the other hand defining exceptions for this rule might become difficult to enforce. So I would prefer to go with a macro, i.e. by defining
Should be sufficient. I dont think we need |
unlike glib's g_return_if_fail, dont log to console if condition fails
refactor all destructor functions to return void if possible and make them safe when called with NULL