Without limit clang-format would join manually broken lines into a single very long line, hindering readability.
style: make clang-format break long lines #21223
pull vasild wants to merge 1 commits into bitcoin:master from vasild:clang-format-ColumnLimit changing 1 files +1 −1-
vasild commented at 1:36 PM on February 18, 2021: member
-
1322dae9da
style: make clang-format break long lines
Without limit clang-format would join manually broken lines into a single very long line, hindering readability.
- laanwj added the label Scripts and tools on Feb 18, 2021
-
vasild commented at 5:36 PM on February 18, 2021: member
Yes (those are not affected by
BinPackParametersandBinPackArgumentsfrom #21221):before (without limit,
master):txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); // for (std::set<uint256>::iterator it = pto->m_tx_relay->setInventoryTxToSend.begin(); it != pto->m_tx_relay->setInventoryTxToSend.end(); it++) { // if (m_shift < n || m_shift >= std::numeric_limits<uint64_t>::max() || m_shift < std::numeric_limits<I>::min() || m_shift > std::numeric_limits<I>::max()) throw std::ios_base::failure("differential value overflow"); // std::vector<CBlockIndex*>::const_iterator lower = std::lower_bound(vChain.begin(), vChain.end(), blockparams, [](CBlockIndex* pBlock, const std::pair<int64_t, int>& blockparams) -> bool { return pBlock->GetBlockTimeMax() < blockparams.first || pBlock->nHeight < blockparams.second; });after (with limit, this PR):
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>( (const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); // for (std::set<uint256>::iterator it = pto->m_tx_relay->setInventoryTxToSend.begin(); it != pto->m_tx_relay->setInventoryTxToSend.end(); it++) { // if (m_shift < n || m_shift >= std::numeric_limits<uint64_t>::max() || m_shift < std::numeric_limits<I>::min() || m_shift > std::numeric_limits<I>::max()) throw std::ios_base::failure("differential value overflow"); // std::vector<CBlockIndex*>::const_iterator lower = std::lower_bound( vChain.begin(), vChain.end(), blockparams, [](CBlockIndex* pBlock, const std::pair<int64_t, int>& blockparams) -> bool { return pBlock->GetBlockTimeMax() < blockparams.first || pBlock->nHeight < blockparams.second; });Maybe I did not pick the best examples, see the output of
git grep '.{100,}' '*.cpp' '*.h'(or 150 for the extreme cases). -
vasild commented at 9:21 AM on February 19, 2021: member
@jnewbery, I just realized that you asked for an example where clang-format would join a manually broken line and I gave examples where it would break a long line (the opposite).
Indeed I cannot find such examples, other than functions' arguments/parameters, which is addressed in #21221.
Closing this in favor of #21221. Will reopen if I find examples where manually broken lines get joined (with #21221 merged).
- vasild closed this on Feb 19, 2021
- DrahtBot locked this on Aug 16, 2022
Labels