mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Prefer compile-time checking over run-time checking
This commit is contained in:
parent
22e301a3d5
commit
d1e6f91f85
@ -37,6 +37,7 @@ code.
|
||||
|
||||
- **Miscellaneous**
|
||||
- `++i` is preferred over `i++`.
|
||||
- `static_assert` is preferred over `assert` where possible. Generally; compile-time checking is preferred over run-time checking.
|
||||
|
||||
Block style example:
|
||||
```c++
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
|
||||
uint64_t GetLow64() const
|
||||
{
|
||||
assert(WIDTH >= 2);
|
||||
static_assert(WIDTH >= 2, "Assertion WIDTH >= 2 failed (WIDTH = BITS / 32). BITS is a template parameter.");
|
||||
return pn[0] | (uint64_t)pn[1] << 32;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user