Fix two warnings for comparison between signed and unsigned #8172

pull sipa wants to merge 1 commits into bitcoin:master from sipa:fixunsigned changing 2 files +2 −2
  1. sipa commented at 1:45 PM on June 8, 2016: member

    Because we know in both cases they don't hold a negative value, simply cast to unsigned.

  2. Fix two warnings for comparison between signed and unsigned 77f63a4fcd
  3. jonasschnelli commented at 1:46 PM on June 8, 2016: contributor

    Finally someone did this. :-)

    Thanks. utACK 77f63a4fcd0517a6804bde7285e1859d5a087d77

  4. jonasschnelli added the label Refactoring on Jun 8, 2016
  5. MarcoFalke commented at 2:01 PM on June 8, 2016: member

    Even if it was negative, we'd get an huge unsigned value which is greater than vout.size().

    utACK 77f63a4

  6. MarcoFalke commented at 2:02 PM on June 8, 2016: member

    Fixes #7889?

  7. kazcw commented at 8:24 PM on June 8, 2016: contributor

    Nit: should we phase out C-style casts? In this case it's obviously just a static_cast, but I think it would be safer to use new-style casts in all new code. I wrote a PR for the developer docs: #8177

  8. laanwj commented at 5:27 AM on June 9, 2016: member

    Nit: should we phase out C-style casts? In this case it's obviously just a static_cast, but I think it would be safer to use new-style casts in all new code. I wrote a PR for the developer docs: #8177

    I've never seen an argument that made c++ style casts safer for this kind of usage. It's much shorter to write C-style casts if you just want to, say, convert a signed integer to an unsigned one, and sometimes this is done quite a few times per line so c++ syntax would be messy.

    (the static cast versus dynamic cast versus reinterpret cast safety seems to apply to pointers and objects)

  9. laanwj merged this on Jun 9, 2016
  10. laanwj closed this on Jun 9, 2016

  11. laanwj referenced this in commit 7e6dd7bee4 on Jun 9, 2016
  12. codablock referenced this in commit ddff6d6e6e on Sep 16, 2017
  13. codablock referenced this in commit 0ff28494f0 on Sep 19, 2017
  14. codablock referenced this in commit cfc76bab9a on Dec 22, 2017
  15. andvgal referenced this in commit 4d2988cb2e on Jan 6, 2019
  16. MarcoFalke 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-19 09:15 UTC

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