mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
docs: Adjust developer-notes.md to use signed ints normally (#3663)
* Adjust developer-notes.md to use signed ints normally Signed-off-by: pasta <pasta@dashboost.org> * Adjust wording in dev-notes Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * remove trailing whitespace Signed-off-by: pasta <pasta@dashboost.org> * Remove trailing whitespace * maybe fix linter Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
8baf69d448
commit
e8e34b836a
@ -407,6 +407,13 @@ class A
|
||||
|
||||
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
|
||||
that are not language lawyers
|
||||
- Prefer signed ints and do not mix signed and unsigned integers. If an unsigned int is used, it should have a good
|
||||
reason. The fact a value will never be negative is not a good reason. The most common reason will be that mod two
|
||||
arithmetic is needed, such as in cryptographic primitives. If you need to make sure that some value is always
|
||||
a non-negative one, use an assertion or exception instead.
|
||||
- *Rationale*: When signed ints are mixed with unsigned ints, the signed int is converted to a unsigned
|
||||
int. If the signed int is some negative `N`, it'll become `INT_MAX - N` which might cause unexpected consequences.
|
||||
|
||||
|
||||
Strings and formatting
|
||||
------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user