Page MenuHomePhabricator

simplified IsHexNumber function

Authored by majcosta on Nov 25 2019, 23:05.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project

removed use of pointer to iterators, spurious function calls and made the function noexcept

Test Plan

wrote a local cpp test testing many possible hex strings including the "" and "0x" edge cases to make sure function behaves appropriately.

also forced substr to throw out_of_range - substr(-1,x) - and made sure it is caught so the 'noexcept' isn't a lie

Diff Detail

rABC Bitcoin ABC
Lint OK
No Unit Test Coverage
Build Status
Buildable 8288
Build 14601: Bitcoin ABC Buildbot
Build 14600: arc lint + arc unit

Event Timeline

majcosta created this revision.Nov 25 2019, 23:05
Owners added a reviewer: Restricted Owners Package.Nov 25 2019, 23:05
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 25 2019, 23:05
majcosta updated this revision to Diff 14413.Nov 25 2019, 23:06

previous diff not clang-formatted properly. is now.

majcosta updated this revision to Diff 14416.Nov 25 2019, 23:15

changed function declaration to noexcept

While the change isn't bad per se, this is actually not helping. This code is maintained today by the Core developers and taking ownership of it just increase our maintenance burden. Without a direct benefit, this is hard to justify.


As an aside, this may allocate memory - though most stdlib will do SSO in practice for 2 chars. Allocating when you can avoid is usually a pretty bad idea.

I understand. Gonna look for something more useful then. Closing.

majcosta abandoned this revision.Nov 26 2019, 00:56