NULL to nullptr #16290

pull Bushstar wants to merge 1 commits into bitcoin:master from Bushstar:null-to-nullptr changing 1 files +1 −1
  1. Bushstar commented at 9:42 AM on June 26, 2019: contributor

    Found this lone instance of NULL when adding and updating some older source files to the 0.18 codebase. This appears to be the only instance of NULL still present.

  2. NULL to nullptr 2f23034687
  3. fanquake added the label Refactoring on Jun 26, 2019
  4. jonasschnelli commented at 9:47 AM on June 26, 2019: contributor

    Meh. Waste of time PR but ACK. Please focus on doing PRs that actually improve things. This looks like an arbitrary NULL->nullptr change without an overall concept.

  5. Bushstar commented at 10:16 AM on June 26, 2019: contributor

    Yesterday I resisted the urge to remove a redundant semicolon!

    https://github.com/bitcoin/bitcoin/blob/ca80fec973f0895b3d150b5af472d778102c315d/src/interfaces/wallet.cpp#L150

    I'll hold off such minor changes in future unless they can be incorporated into some larger more productive work.

  6. fanquake commented at 10:31 AM on June 26, 2019: member

    Thanks, however for the reasons stated above I'm just going to close this.

    Yesterday I resisted the urge to remove a redundant semicolon!

    Thanks for resisting the urge.

    Note: If you ever do happen to open such a PR (applies to all PRs anyways), always try and make it as easy to merge as possible. Set a proper PR title and use a good message. i.e in this case both could just be refactor: use nullptr instead of NULL in wallet.cpp.

  7. fanquake closed this on Jun 26, 2019

  8. practicalswift commented at 3:25 PM on June 26, 2019: contributor

    @Bushstar

    A one-off change like this is temporary in that someone is likely to accidentally use NULL instead of nullptr again in the future.

    Thus the change is temporary.

    Try thinking about how one would make change permanent instead.

    That is instead of fixing this specific instance: fix the entire class and thus all future instances.

    In this case it could easily be linted away using git grep:

    $ git grep "[^A-Z_]NULL[^A-Z_]" -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" ":(exclude)*torcontrol*" | grep -vE "//.*NULL"
    src/wallet/wallet.cpp:        return NULL;
    

    Personally I would rather see one permanent linter PR than an infinite stream of temporary fixes :-)

    You can see how the other linters are implemented in test/lint/.

    You could try building a NULL-linter by looking how test/lint/lint-assertions.sh is implemented.

  9. DrahtBot locked this on Dec 16, 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-22 06:14 UTC

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