Use nullptr (C++11) instead of zero (0) as the null pointer constant #10645

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:welcome-nullptr-goodbye-0 changing 16 files +41 −41
  1. practicalswift commented at 7:12 PM on June 21, 2017: contributor

    Use nullptr instead of zero (0) as the null pointer constant.

    The road towards nullptr (C++11) is split into two PRs:

    • NULLnullptr is handled in PR #10483 (scripted)
    • 0nullptr is handled in PR #10645 (manual, this PR)

    By using the C++11 keyword nullptr we are guaranteed a prvalue of type std::nullptr_t.

    For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter & Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf

  2. practicalswift cross-referenced this on Jun 21, 2017 from issue scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL by practicalswift
  3. practicalswift force-pushed on Jun 21, 2017
  4. practicalswift renamed this:
    Use nullptr instead of zero (0) as the null pointer constant
    Use nullptr (C++11) instead of zero (0) as the null pointer constant
    on Jun 21, 2017
  5. fanquake added the label Refactoring on Jun 21, 2017
  6. jtimon commented at 1:26 AM on June 22, 2017: contributor

    utACK a0fbff2c8c0621d2ef4759078b3c690f1c33748b

  7. gmaxwell commented at 6:37 PM on June 22, 2017: contributor

    Concept ACK

  8. practicalswift force-pushed on Jun 22, 2017
  9. practicalswift commented at 7:06 PM on June 22, 2017: contributor

    Rebased!

  10. practicalswift force-pushed on Aug 9, 2017
  11. laanwj referenced this in commit ce74799a3c on Aug 14, 2017
  12. practicalswift force-pushed on Aug 14, 2017
  13. practicalswift commented at 3:40 PM on August 14, 2017: contributor

    @laanwj Thanks for merging the NULL → nullptr PR (#10483). This PR handles the case 0 → nullptr and has now been rebased on top of master.

  14. dcousens approved
  15. in src/tinyformat.h:901 in f71710dad4 outdated
     897 | @@ -898,7 +898,7 @@ class FormatListN : public FormatList
     898 |  // Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard
     899 |  template<> class FormatListN<0> : public FormatList
     900 |  {
     901 | -    public: FormatListN() : FormatList(0, 0) {}
     902 | +    public: FormatListN() : FormatList(nullptr, 0) {}
    


    jnewbery commented at 9:03 PM on August 15, 2017:

    There may be an argument to not making style changes to tinyformat.h, which occasionally pulls in changes from upstream. Don't know what @laanwj's view is on this?


    laanwj commented at 8:10 AM on August 16, 2017:

    Agree, we should generally minimize changes to tinyformat.h, and if it is just style it just adds burden on us with no clear gain.

    If you get upstream to accept this it's okay with me. But I think they want to keep compatiblity with older C++.

  16. jnewbery commented at 9:03 PM on August 15, 2017: member

    Tested ACK f71710dad454f5afe431479d0aea578b36d68206. Looks good @practicalswift . Thanks for doing this!

    One open question for @laanwj

  17. Use nullptr instead of zero (0) as the null pointer constant 36d326e8b0
  18. practicalswift force-pushed on Aug 16, 2017
  19. practicalswift commented at 8:25 AM on August 16, 2017: contributor

    @jnewbery @laanwj Good point! The change to src/tinyformat.h is no longer included in this PR.

  20. MarcoFalke merged this on Aug 16, 2017
  21. MarcoFalke closed this on Aug 16, 2017

  22. MarcoFalke referenced this in commit c484ec6c9b on Aug 16, 2017
  23. practicalswift cross-referenced this on Aug 16, 2017 from issue Document the preference of nullptr over NULL or (void*)0 by practicalswift
  24. laanwj referenced this in commit 9e00a625b4 on Aug 18, 2017
  25. Empact cross-referenced this on Jan 5, 2019 from issue build: Optionally enable -Wzero-as-null-pointer-constant by Empact
  26. PastaPastaPasta referenced this in commit aa160709d0 on Sep 19, 2019
  27. PastaPastaPasta referenced this in commit 3eda56fff5 on Sep 19, 2019
  28. PastaPastaPasta referenced this in commit 51801c02f9 on Sep 23, 2019
  29. PastaPastaPasta referenced this in commit 91ac93c63f on Sep 23, 2019
  30. PastaPastaPasta referenced this in commit b041cb30d7 on Sep 24, 2019
  31. PastaPastaPasta referenced this in commit c2171001d5 on Sep 24, 2019
  32. PastaPastaPasta referenced this in commit 5c6bd04c1c on Nov 19, 2019
  33. PastaPastaPasta referenced this in commit 77523f121f on Nov 19, 2019
  34. PastaPastaPasta referenced this in commit b19a6a64ed on Nov 21, 2019
  35. PastaPastaPasta referenced this in commit 1d3f9a70b8 on Nov 21, 2019
  36. PastaPastaPasta referenced this in commit be02c92f72 on Dec 9, 2019
  37. PastaPastaPasta referenced this in commit 47a0b82324 on Dec 9, 2019
  38. PastaPastaPasta referenced this in commit 38bb8a8909 on Jan 1, 2020
  39. PastaPastaPasta referenced this in commit 1b943d67ea on Jan 1, 2020
  40. PastaPastaPasta referenced this in commit 9d58c98753 on Jan 2, 2020
  41. PastaPastaPasta referenced this in commit a5ee45e8f7 on Jan 2, 2020
  42. PastaPastaPasta referenced this in commit ab52753cc2 on Jan 2, 2020
  43. PastaPastaPasta referenced this in commit 87a6d62f21 on Jan 2, 2020
  44. PastaPastaPasta referenced this in commit d737b59d45 on Jan 2, 2020
  45. PastaPastaPasta referenced this in commit 6984c98882 on Jan 3, 2020
  46. str4d referenced this in commit e591f94fcf on Jul 31, 2020
  47. str4d cross-referenced this on Jul 31, 2020 from issue Locked memory manager by str4d
  48. zkbot referenced this in commit 5ef5d8d268 on Jul 31, 2020
  49. zkbot referenced this in commit 7d94064616 on Sep 29, 2020
  50. ckti referenced this in commit d7d0d4db21 on Mar 28, 2021
  51. ckti referenced this in commit eb7e61ccae on Mar 28, 2021
  52. practicalswift deleted the branch on Apr 10, 2021
  53. barton2526 cross-referenced this on Jun 12, 2021 from issue refactor: misc style changes by div72
  54. gades referenced this in commit e1ff51567c on Jun 24, 2021
  55. gades referenced this in commit 651b72418a on Jun 26, 2021
  56. gades referenced this in commit 4a3bc05874 on Jan 29, 2022
  57. gades referenced this in commit 4dd3ea416b on Feb 22, 2022
  58. bitcoin locked this on Aug 18, 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: 2026-05-20 06:55 UTC