Changeset View
Changeset View
Standalone View
Standalone View
doc/developer-notes.md
Show First 20 Lines • Show All 481 Lines • ▼ Show 20 Lines | |||||
- Make sure that constructors initialize all fields. If this is skipped for a | - Make sure that constructors initialize all fields. If this is skipped for a | ||||
good reason (i.e., optimization on the critical path), add an explicit | good reason (i.e., optimization on the critical path), add an explicit | ||||
comment about this | comment about this | ||||
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized | - *Rationale*: Ensure determinism by avoiding accidental use of uninitialized | ||||
values. Also, static analyzers balk about this. | values. Also, static analyzers balk about this. | ||||
- By default, declare single-argument constructors `explicit`. | |||||
- *Rationale*: This is a precaution to avoid unintended conversions that might | |||||
arise when single-argument constructors are used as implicit conversion | |||||
functions. | |||||
- Use explicitly signed or unsigned `char`s, or even better `uint8_t` and | - Use explicitly signed or unsigned `char`s, or even better `uint8_t` and | ||||
`int8_t`. Do not use bare `char` unless it is to pass to a third-party API. | `int8_t`. Do not use bare `char` unless it is to pass to a third-party API. | ||||
This type can be signed or unsigned depending on the architecture, which can | This type can be signed or unsigned depending on the architecture, which can | ||||
lead to interoperability problems or dangerous conditions such as | lead to interoperability problems or dangerous conditions such as | ||||
out-of-bounds array accesses | out-of-bounds array accesses | ||||
- Prefer explicit constructions over implicit ones that rely on 'magical' C++ behavior | - Prefer explicit constructions over implicit ones that rely on 'magical' C++ behavior | ||||
▲ Show 20 Lines • Show All 412 Lines • Show Last 20 Lines |