developer notes questions #17810

issue sanjaykdragon opened this issue on December 27, 2019
  1. sanjaykdragon commented at 10:37 PM on December 27, 2019: contributor

    Referring to: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-c

    What are the views on using auto in the code? What about conditional operators? (auto x = bool ? 90 : 92)

  2. sanjaykdragon renamed this:
    developer notes quetsion
    developer notes questions
    on Dec 27, 2019
  3. MarcoFalke commented at 12:41 AM on December 28, 2019: member

    It is generally discouraged, especially for short types such as int or bool. Though it can be used to make code more readable. E.g assigning a lambda to a named variable with the auto type https://github.com/bitcoin/bitcoin/blob/6cb80a068dc198832febe456139bed3ae7a1145c/src/net_processing.cpp#L1351 or a boost multimap iterator in the mempool https://github.com/bitcoin/bitcoin/blob/6cb80a068dc198832febe456139bed3ae7a1145c/src/txmempool.cpp#L132

  4. MarcoFalke closed this on Dec 28, 2019

  5. fanquake locked this on Apr 9, 2020

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-02 21:14 UTC

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