delete nullptr,0 section of style guide
The nullptr/0 distinction should go without saying, and I think worrying about any of the rest just burns brainpower. Change-Id: I7d0aea300f114e512437c3820f4e80a1408575c1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312472 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
3cdc259008
commit
216b984d39
@ -460,29 +460,6 @@ Summary: Use `int` unless you have need a guarantee on the bit count, then use
|
||||
of using unsigned. Bitfields use `uint32_t` unless they have to be made shorter
|
||||
for packing or performance reasons.
|
||||
|
||||
`nullptr`, 0
|
||||
------------
|
||||
|
||||
Use `nullptr` for pointers, 0 for ints. We suggest explicit `nullptr` comparisons when
|
||||
checking for `nullptr` pointers, as documentation:
|
||||
|
||||
<!--?prettify?-->
|
||||
~~~~
|
||||
if (nullptr == x) { // slightly preferred over if (!x)
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
When checking non-`nullptr` pointers we think implicit comparisons read better than
|
||||
an explicit comparison's double negative:
|
||||
|
||||
<!--?prettify?-->
|
||||
~~~~
|
||||
if (x) { // slightly preferred over if (nullptr != x)
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
Function Parameters
|
||||
-------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user