ethz-asl / programming_guidelines

This repository contains style-guides, discussions, eclipse/emacs auto-formatter for commonly used programming languages
139 stars 38 forks source link

Why not allowing Implicit test for 0 for pointers? #10

Closed stephanemagnenat closed 11 years ago

stephanemagnenat commented 11 years ago

As for 55, it makes sense for pointers to test for non 0 using

int* p(0);
if (p)
    ...

So I do no agree with 70. I find that C++ is already quite verbose, and making it less verbose while keeping the code easy to read should be a target.

simonlynen commented 11 years ago

70 would still allow the implicit test. I moved 70 up to be right after the rule which discourages implicit tests of float/int and added a note that implicit tests are ok for pointers and bools.