Skip to content

Add code style rule regarding comparisons

Michael Catanzaro requested to merge mcatanzaro/style into master

Epiphany code is currently inconsistent as to whether we should explicitly compare pointers against NULL. Very recently, I started writing explicit comparisons everywhere, after learning that this is now encouraged by the GLib maintainers. However, I've started having second thoughts. It's verbose, for one. Also, the C++ community is working on style guidelines to discourage this:

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es87-dont-add-redundant--or--to-conditions

They make sense to me. We already have a similar rule in WebKit, except WebKit also enforces this for integer comparisons against zero. I don't like that. Let's follow the C++ core guidelines advise instead.

@jbrummer, what do you think? It's a change from what I suggested recently. We should come up with some rule and add it to the HACKING file regardless.

Merge request reports