I’m a verbose guy when it comes to code. The compiler doesn’t care and it’s easier for me to read later on down the road. I’ve changed my style over the past few months, it started at Pelco because I was confusing folks with a particular syntax. I must admit, it even confused me on occasion.
When checking pointers I used to do this.
if (NULL != ptr)
That was confusing. I’ve since switched my tune back to a tried and true method of removing the NULL !=, like this
Much easier for most to understand. I do, however, still check for explicit FALSE and NULL as the case may be, because I believe it to be a bit more clear. Here’s what that looks like.
if (NULL == ptr)
if (FALSE == value)
There is a statement some don’t like, that I love, and probably won’t switch away from. The ternary operator.
something = (value) ? value1 : value2;
My brain just likes it.