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)
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)
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