tests: Initialize recently introduced non-static class member lastCycles to zero in constructor #11654

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:uninitialized-members changing 1 files +11 −6
  1. practicalswift commented at 1:47 PM on November 10, 2017: contributor

    Initialize recently introduced non-static class member lastCycles to zero in constructor.

    lastCycles was introduced in 35328187463a7078b4206e394c21d5515929c7de which was merged into master yesterday.

    Friendly ping @laanwj :-)

  2. fanquake added the label Tests on Nov 10, 2017
  3. practicalswift renamed this:
    Initialize recently introduced non-static class member lastCycles to zero in constructor
    tests: Initialize recently introduced non-static class member lastCycles to zero in constructor
    on Nov 10, 2017
  4. promag commented at 9:13 PM on November 10, 2017: member

    utACK ac78e5c.

    It would be nice to have one initialization flavour. Also, split members that don't have to be initialized with a comment.

  5. in src/bench/bench.h:65 in ac78e5c14d outdated
      64 | @@ -65,6 +65,7 @@ namespace benchmark {
      65 |              minCycles = std::numeric_limits<uint64_t>::max();
    


    laanwj commented at 7:35 AM on November 11, 2017:

    Yeah let's change it to

    State(std::string _name, duration _maxElapsed) :
    name(_name),
    maxElapsed(_maxElapsed),
    count(0),
    minTime(duration::max()), 
    maxTime(duration::zero()),
    minCycles(std::numeric_limits<uint64_t>::max()),
    maxCycles(maxCycles = std::numeric_limits<uint64_t>::min()),
    countMask(1),
    lastCycles(0)
    

    Makes it easier to see that everything is initialized.

  6. practicalswift force-pushed on Nov 12, 2017
  7. practicalswift commented at 3:47 PM on November 12, 2017: contributor

    @laanwj Good point! Now fixed :-)

  8. in src/bench/bench.h:65 in 22ce5f15e8 outdated
      66 | -            maxCycles = std::numeric_limits<uint64_t>::min();
      67 | -            countMask = 1;
      68 | +        State(std::string _name, duration _maxElapsed) :
      69 | +            name(_name),
      70 | +            maxElapsed(_maxElapsed),
      71 | +            count(0),
    


    MarcoFalke commented at 8:03 PM on November 13, 2017:

    Please obey -Wreorder


    practicalswift commented at 9:32 PM on November 13, 2017:

    Oh, of course. Now fixed! Thanks for notifying :-)

  9. practicalswift force-pushed on Nov 13, 2017
  10. Initialize recently introduced non-static class member lastCycles to zero in constructor
    lastCycles was introduced in 35328187463a7078b4206e394c21d5515929c7de which was merged into master yesterday.
    
    Also initialize beginCycles to zero for consistency and completeness.
    069215ebe2
  11. practicalswift force-pushed on Nov 13, 2017
  12. practicalswift commented at 9:38 PM on November 13, 2017: contributor

    Addressed @MarcoFalke:s feedback initialization order. Now also initializing beginCycles to zero for consistency and completeness.

    Please re-review :-)

  13. MarcoFalke commented at 10:09 PM on November 13, 2017: member

    utACK 069215ebe2d9c7cce7cee74b1f13f6e0daf552e9

  14. laanwj merged this on Nov 16, 2017
  15. laanwj closed this on Nov 16, 2017

  16. laanwj referenced this in commit 084f52f38d on Nov 16, 2017
  17. laanwj referenced this in commit 21e2670de3 on Mar 5, 2018
  18. zkbot referenced this in commit aa225ebb0b on Jan 24, 2020
  19. zkbot referenced this in commit 74ff73abab on Jan 24, 2020
  20. PastaPastaPasta referenced this in commit 853d643110 on Jan 31, 2020
  21. PastaPastaPasta referenced this in commit 6fff9726c4 on Feb 4, 2020
  22. PastaPastaPasta referenced this in commit 5f4770dc33 on Feb 9, 2020
  23. furszy referenced this in commit 4ed15cc69d on Jun 8, 2020
  24. PastaPastaPasta referenced this in commit 45beb63cf2 on Jun 10, 2020
  25. PastaPastaPasta referenced this in commit 967a681da8 on Jun 12, 2020
  26. PastaPastaPasta referenced this in commit b541a28a74 on Jun 13, 2020
  27. PastaPastaPasta referenced this in commit 7e8d72c862 on Jun 14, 2020
  28. PastaPastaPasta referenced this in commit 28879fc052 on Jun 14, 2020
  29. ckti referenced this in commit b29be87df3 on Mar 28, 2021
  30. gades referenced this in commit 72de7a77d4 on Jun 30, 2021
  31. DrahtBot locked this on Sep 8, 2021

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: 2026-04-16 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me