Skip to content

Commit 3d53a85

Browse files
committed
Merge bitcoin/bitcoin#27220: doc: update broken str util reference links on developer-notes
da347de doc: update broken links (pablomartin4btc) Pull request description: References to `utilstrencodings` and `lint-locale-dependence.sh` where incorrect, updating them accordingly. Also, adding another reference to util function [`LocaleIndependentAtoi`](https://github.com/bitcoin/bitcoin/blob/master/src/util/strencodings.h#L108-L118), which is related with the updated section of the guide: ``` // LocaleIndependentAtoi is provided for backwards compatibility reasons. // // New code should use ToIntegral or the ParseInt* functions // which provide parse error feedback. // // The goal of LocaleIndependentAtoi is to replicate the defined behaviour of // std::atoi as it behaves under the "C" locale, and remove some undefined // behavior. If the parsed value is bigger than the integer type's maximum // value, or smaller than the integer type's minimum value, std::atoi has // undefined behavior, while this function returns the maximum or minimum // values, respectively. ``` ACKs for top commit: MarcoFalke: lgtm ACK da347de Tree-SHA512: c8f4cd9cff1fb3ea367ac9dbe5aa45dc187fc60114f2e2106e02e0e17fea4ee34d6e0c408fe920c2d8765e06b4dc30c231f0454fa35469c4399e0cadbcd341ba
2 parents c7f1d95 + da347de commit 3d53a85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/developer-notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,12 +860,12 @@ Strings and formatting
860860
buffer overflows, and surprises with `\0` characters. Also, some C string manipulations
861861
tend to act differently depending on platform, or even the user locale.
862862
863-
- Use `ParseInt32`, `ParseInt64`, `ParseUInt32`, `ParseUInt64`, `ParseDouble` from `utilstrencodings.h` for number parsing.
863+
- Use `ToIntegral` from [`strencodings.h`](/src/util/strencodings.h) for number parsing. In legacy code you might also find `ParseInt*` family of functions, `ParseDouble` or `LocaleIndependentAtoi`.
864864
865865
- *Rationale*: These functions do overflow checking and avoid pesky locale issues.
866866
867867
- Avoid using locale dependent functions if possible. You can use the provided
868-
[`lint-locale-dependence.sh`](/test/lint/lint-locale-dependence.sh)
868+
[`lint-locale-dependence.py`](/test/lint/lint-locale-dependence.py)
869869
to check for accidental use of locale dependent functions.
870870
871871
- *Rationale*: Unnecessary locale dependence can cause bugs that are very tricky to isolate and fix.

0 commit comments

Comments
 (0)