Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) #13383

Conversation

practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Jun 3, 2018

  • Non-Boost is better than Boost.
  • Non-throwing is better than throwing.
  • Explicit error handling is better than implicit error handling.
  • ParseDouble(…) deserves to be used outside of its unit tests :-)

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK b710aab38d01393412616d4a31fc4a4b3011e747

@@ -9,8 +9,7 @@
#include <validation.h>
#include <util.h>
#include <random.h>

#include <boost/lexical_cast.hpp>
#include <utilstrencodings.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can run the clang format diff script to sort includes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed!

@maflcko maflcko added the Tests label Jun 3, 2018
@practicalswift practicalswift force-pushed the remove-dependency-on-lexical_cast-which-is-boost-and-also-throws branch from b710aab to f41d339 Compare June 3, 2018 19:30
@laanwj
Copy link
Member

laanwj commented Jun 4, 2018

How tf did boost::lexical_cast sneak into our codebase again?!?

Thank you for noticing, and using the function that was created for that purpose.

utACK f41d339

@laanwj laanwj merged commit f41d339 into bitcoin:master Jun 4, 2018
laanwj added a commit that referenced this pull request Jun 4, 2018
…owing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
laanwj added a commit that referenced this pull request Jun 5, 2018
…st dependencies

81bbd32 build: Guard against accidental introduction of new Boost dependencies (practicalswift)

Pull request description:

  Guard against accidental introduction of new Boost dependencies.

  Context: #13383 – the usage of `boost::lexical_cast` was introduced in #11517 from December 2017

Tree-SHA512: 8d7b667ecf7ea62d84d9d41a71726f1e46c5a411b5a7db475c973ef364cac65609399afda7931e143a27d40c2947ff286e5e98ab263e8f0d225e2ae2c0872935
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 27, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 24, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 24, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 24, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 24, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to jonspock/devault that referenced this pull request Dec 24, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
jonspock pushed a commit to devaultcrypto/devault that referenced this pull request Dec 26, 2019
…exical_cast<double>(...)

Summary:
* Non-Boost is better than Boost.
* Non-throwing is better than throwing.
* Explicit error handling is better than implicit error handling.
* `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Backport of Bitcoin Core PR13383
bitcoin/bitcoin#13383

Test Plan:
```
make check-all
```

Reviewers: Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D4080
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 17, 2020
…new Boost dependencies

81bbd32 build: Guard against accidental introduction of new Boost dependencies (practicalswift)

Pull request description:

  Guard against accidental introduction of new Boost dependencies.

  Context: bitcoin#13383 – the usage of `boost::lexical_cast` was introduced in bitcoin#11517 from December 2017

Tree-SHA512: 8d7b667ecf7ea62d84d9d41a71726f1e46c5a411b5a7db475c973ef364cac65609399afda7931e143a27d40c2947ff286e5e98ab263e8f0d225e2ae2c0872935
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 2, 2020
…new Boost dependencies

81bbd32 build: Guard against accidental introduction of new Boost dependencies (practicalswift)

Pull request description:

  Guard against accidental introduction of new Boost dependencies.

  Context: bitcoin#13383 – the usage of `boost::lexical_cast` was introduced in bitcoin#11517 from December 2017

Tree-SHA512: 8d7b667ecf7ea62d84d9d41a71726f1e46c5a411b5a7db475c973ef364cac65609399afda7931e143a27d40c2947ff286e5e98ab263e8f0d225e2ae2c0872935
@practicalswift practicalswift deleted the remove-dependency-on-lexical_cast-which-is-boost-and-also-throws branch April 10, 2021 19:34
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jun 19, 2021
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jun 24, 2021
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jun 26, 2021
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jun 26, 2021
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jun 28, 2021
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Feb 9, 2022
ad5717d Lint: Add lint-includes.sh (Fuzzbawls)
faba3f6 [tests] Use FastRandomContext in scheduler_tests.cpp (practicalswift)
2034bf6 Remove unused boost includes in reverselock_tests.cpp (Fuzzbawls)
3256d16 bench: Use non-throwing ParseDouble() (Fuzzbawls)
3c984d1 Remove duplicate includes (Fuzzbawls)
b54e396 Declare TorReply parsing functions in torcontrol_tests (Fuzzbawls)

Pull request description:

  This brings in the `lint-includes.sh` shell script from upstream (first introduced in bitcoin#11878) to automatically check for duplicate includes and expanded in bitcoin#13301 and bitcoin#13385 to check for the inclusion of `.cpp` files and the introduction of new boost includes, respectively.

  The check for enforcing bracket include syntax (bitcoin#13230) is also included, but currently disabled, as we have yet to systematically switch to that syntax preference.

  Three other upstream PRs are backported here as they are directly related to the removal of some boost dependencies and are very straight forward:
  - bitcoin#10547
  - bitcoin#13291
  - bitcoin#13383

  **NOTE: #2711 removes the dependency on `boost/tuple/tuple.hpp`, so it makes sense to merge that first. submitting this now so the general concept/functionality can be reviewed prior to that PR being merged**

ACKs for top commit:
  furszy:
    good ACK ad5717d
  random-zebra:
    utACK ad5717d and merging...

Tree-SHA512: d9d32d6d5122dac52c9601cda75612d87c4e027c6f196a2382206b227fcfd2bb61d4f72df7cbf5e572d94150ad8ca6db6301bd99b0da647b9627fe342b66873f
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 21, 2022
…new Boost dependencies

81bbd32 build: Guard against accidental introduction of new Boost dependencies (practicalswift)

Pull request description:

  Guard against accidental introduction of new Boost dependencies.

  Context: bitcoin#13383 – the usage of `boost::lexical_cast` was introduced in bitcoin#11517 from December 2017

Tree-SHA512: 8d7b667ecf7ea62d84d9d41a71726f1e46c5a411b5a7db475c973ef364cac65609399afda7931e143a27d40c2947ff286e5e98ab263e8f0d225e2ae2c0872935
gades pushed a commit to cosanta/cosanta-core that referenced this pull request May 1, 2022
… of throwing boost::lexical_cast<double>(...)

f41d339 bench: Use non-throwing ParseDouble(...) instead of throwing boost::lexical_cast<double>(...) (practicalswift)

Pull request description:

  * Non-Boost is better than Boost.
  * Non-throwing is better than throwing.
  * Explicit error handling is better than implicit error handling.
  * `ParseDouble(…)` deserves to be used outside of its unit tests :-)

Tree-SHA512: a8cf04a5f8363cb7ced0bcaf1fed00e1e5dd6a63a6c11e5f0ba4e5c845b0df7c2b050d887075f158cd62dc7e02843ecaafc15e42e383c066461c6d7399e06b49
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants