3 ms·
My concerns are well addressed in the patch: if (b->d != NULL) {
by yread 13y ago
My concerns are well addressed in the patch:
if (b->d != NULL)
{
- Nursie 13y agoThere's no need to explicitly include NULL in there, it buys you nothing. Insisting on braces is a style concern, though it does seem to protect people from themselves to some extent.
- CamperBob2 13y agoIf you're careful to use NULL only in pointer expressions, it can be used to indicate that a pointer is being tested, as opposed to any other sort of integer or boolean flag. You can justify it on grounds similar to Hungarian notation, giving the reader some contextual information that might otherwise require a look at a declaration somewhere else. Code should be written for the benefit of humans, not compilers.
- Nursie 13y agoI agree, but the humans also need to be able to understand the code. I've worked in places where the ternary operator was banned because 'some people might not understand it'. This is silly.
- CamperBob2 13y agoYeah, that's pretty goofy. Being intimidated by the ternary operator is how you know you should have gone into marketing instead.
- logicallee 13y agoI don't think you should be testing for truth implicitly like that, try if ((bool(b->d != NULL) == true) { } much better to be explicit, don't you think?
- Nursie 13y agoAssuming this is satire, LOL :)