diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-02-14 09:48:28 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-02-14 09:48:31 +0100 |
commit | df8892dc9f05dbc3589457ed8ce080ca9cb4a594 (patch) | |
tree | 8307620a1c69f61c7c1e20bec05f68589279db8b /depends | |
parent | e4f0c4cd73d89592450e5900b32ffeafb5f332f4 (diff) | |
parent | aa929abf8dc022e900755234c857541faeea8239 (diff) | |
download | bitcoin-df8892dc9f05dbc3589457ed8ce080ca9cb4a594.tar.xz |
Merge #20986: docs: update developer notes to discourage very long lines
aa929abf8dc022e900755234c857541faeea8239 [docs] Update developer notes to discourage very long lines (John Newbery)
Pull request description:
Mandatory rules on line lengths are bad - there will always be cases where a longer line is more readable than the alternative.
However, very long lines for no good reason _do_ hurt readability. For example, this declaration in validation.h is 274 chars:
```c++
bool ConnectTip(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions& disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
```
That won't fit on one line without wrapping on my 27" monitor with a comfortable font size. Much easier to read is something like:
```c++
bool ConnectTip(BlockValidationState& state, const CChainParams& chainparams,
CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock,
ConnectTrace& connectTrace, DisconnectedBlockTransactions& disconnectpool)
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
```
Therefore, _discourage_ (don't forbid) line lengths greater than 100 characters in our developer style guide.
100 chars is somewhat arbitrary. The old standard was 80, but that seems very limiting with modern displays.
ACKs for top commit:
fanquake:
ACK aa929abf8dc022e900755234c857541faeea8239 - this is basically just something to point too when a PR has unreasonably long lines for no particularly reason.
practicalswift:
ACK aa929abf8dc022e900755234c857541faeea8239
amitiuttarwar:
ACK aa929abf8dc022e900755234c857541faeea8239
theStack:
ACK aa929abf8dc022e900755234c857541faeea8239
glozow:
ACK https://github.com/bitcoin/bitcoin/commit/aa929abf8dc022e900755234c857541faeea8239
Tree-SHA512: 17f1b11f811137497ede8851ede93fa612dc622922b5ad7ac8f065ea026d9a718db5b92325754b74d24012b4d45c4e2cd5cd439a6a8d34bbabf5da927d783970
Diffstat (limited to 'depends')
0 files changed, 0 insertions, 0 deletions