boost::posix_time::ptime(boost::gregorian::date(1970,1,1)
throwsbad_year
,bad_day_of_month
, orbad_day_month
(derivatives ofstd::out_of_range
) if the year, month or day are out of range. It is obvious to us that it won’t throw at run-time for1970-01-01
, but that is not obvious for the compiler or static analyzers. From a static analyzer perspective it will look like these exceptions can reach all the way up toNodeImpl::appInitMain()
where they are unhandled.boost::posix_time::from_time_t(0)
is simpler and doesn’t throw.- Re-use the result of
boost::posix_time::from_time_t(0)
like we’re doing inDecodeDumpTime(…)
. - Mark
GetTimeMillis()
andGetTimeMicros()
asnoexcept
.
util: Don’t throw in GetTime{Millis,Micros}(). Mark as noexcept. #13382
pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:dont-throw-in-GetTimeMillis-and-GetTimeMicros changing 2 files +8 −6-
practicalswift commented at 5:23 pm on June 3, 2018: contributor
-
qmma70 commented at 11:48 pm on June 3, 2018: contributorWhy not use
std::chrono::high_resolution_clock
? -
practicalswift commented at 8:42 pm on June 14, 2018: contributor@qmma70 I’m all for removing Boost, but that is something for another PR :-)
-
sipa commented at 11:31 pm on June 14, 2018: memberutACK bcdf285db285932365fe6cae17ba5a585cd1a17e
-
fanquake requested review from theuni on Jun 17, 2018
-
fanquake added the label Utils/log/libs on Jul 1, 2018
-
DrahtBot commented at 3:16 pm on July 29, 2018: member
-
DrahtBot closed this on Jul 29, 2018
-
DrahtBot reopened this on Jul 29, 2018
-
Empact commented at 5:35 pm on August 11, 2018: member
noexcept
doesn’t sit right with me here. https://google.github.io/styleguide/cppguide.html#noexcept https://akrzemi1.wordpress.com/2014/04/24/noexcept-what-for/ -
Empact commented at 11:10 pm on August 11, 2018: memberI guess I’m more wondering: what is the justification for it? If it doesn’t help with significant performance optimizations (ala
move
) and we don’t expect it to affect the error performance of the method (because we don’t expect it to throw) then why should we apply the treatment? If we should apply it here, should we apply it to most methods? Just a notion. -
practicalswift commented at 2:10 pm on October 7, 2018: contributor@Empact Scott Meyers has this to say about
noexcept
: http://aristeia.com/EC++11-14/noexcept%202014-03-31.pdf – “Declarenoexcept
whenever possible” :-) -
DrahtBot commented at 10:59 am on October 20, 2018: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
No conflicts as of last run.
-
DrahtBot added the label Needs rebase on Nov 5, 2018
-
Don't throw in GetTime{Millis,Micros}(). Mark as noexcept. afc97c731e
-
practicalswift force-pushed on Nov 5, 2018
-
DrahtBot removed the label Needs rebase on Nov 5, 2018
-
ken2812221 commented at 7:14 am on December 2, 2018: contributorutACK afc97c731e407f87fae0385aa5c3a729981ca1aa
-
MarcoFalke commented at 8:02 pm on December 3, 2018: memberLooks like this is made obsolete by something like #9566?
-
practicalswift commented at 8:43 pm on December 3, 2018: contributor
@MarcoFalke Yes, guess so.
Perhaps I should close this PR? The interest in making
GetTime{Millis,Micros}()
noexcept
seems to be limited: only @sipa, @ken2812221 and I have expressed interest in getting this in :-) -
practicalswift closed this on Dec 19, 2018
-
practicalswift deleted the branch on Apr 10, 2021
-
DrahtBot locked this on Aug 16, 2022
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-27 00:12 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-27 00:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me