... | ... | @@ -100,7 +100,7 @@ In C++ we use the BSD style (also from BIND 9), where continuing lines are align |
|
|
```cpp
|
|
|
if (JS_DefineProperty(cx, o, "data",
|
|
|
STRING_TO_JSVAL(JS_NewStringCopyN(cx, data, res)),
|
|
|
NULL, NULL, JSPROP_ENUMERATE) != 0) {
|
|
|
0, 0, JSPROP_ENUMERATE) != 0) {
|
|
|
```
|
|
|
|
|
|
|
... | ... | @@ -536,7 +536,8 @@ We changed the guideline for BIND 10 for the following reasons: |
|
|
revisit the guideline rather than pursuing how to enforce it.
|
|
|
- The implicit form doesn't weaken code safety.
|
|
|
- `NULL` is usually defined as a macro. In general, it's better to
|
|
|
avoid macros in C++ code.
|
|
|
avoid macros in C++ code. And in fact NULL is pure C and formally
|
|
|
does not exist in C++...
|
|
|
|
|
|
Note that there are still many NULL checks in the "explicit" form in
|
|
|
the source tree as of this writing (April 2013) as we began with the
|
... | ... | @@ -549,11 +550,16 @@ See also a mailing list discussion starting from: https://lists.isc.org/pipermai |
|
|
and related discussion in a conference call http://bind10.isc.org/wiki/WeeklyMinutes20130115
|
|
|
when we decided to make the change.
|
|
|
|
|
|
This guide line was written before nullptr was added to C++. There was a short discussion
|
|
|
about switching to nullptr at that time and the conclusion was to not do that. So
|
|
|
there should be no nullptr in the Kea internal code (external libraries can have
|
|
|
adopted a different position).
|
|
|
|
|
|
## Log Statement Safety
|
|
|
|
|
|
It is extremely important to examine all arguments passed into a log
|
|
|
statement to ensure they will produce safe values at runtime:
|
|
|
- Can the argument (or any part of it) be NULL? If so is this taken into account?
|
|
|
- Can the argument (or any part of it) be null? If so is this taken into account?
|
|
|
- If the argument invokes any functions, are they exception safe?
|
|
|
- If it involves indirection, does this always resolve into a usable value?
|
|
|
- If it raises an exception, is the exception caught? This includes double errors, i.e., log statements in an exception handler.
|
... | ... | @@ -687,4 +693,4 @@ they are not part of the BIND 10's coding guidelines. |
|
|
|
|
|
* Google: https://google.github.io/styleguide/cppguide.html
|
|
|
* Mozilla: https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html
|
|
|
* XORP: https://fossies.org/linux/xorp/devnotes/coding-style.txt |
|
|
* XORP: https://fossies.org/linux/xorp/devnotes/coding-style.txt |
|
|
\ No newline at end of file |