Closed Erroneous1 closed 6 years ago
Again, this is some quality optimization work. One purely aesthetic critique before pulling. I know everyone has their preferences but I'm trying to keep the project consistent. I feel lines stretching beyond 80 characters should be broken along arguments. For example:
inline bool operator()(const RequestId& x, const RequestId& y) const noexcept
should become
inline bool operator()(
const RequestId& x,
const RequestId& y) const noexcept
I know it's trivial but long lines bug me to no end.
I completely understand about line width.
The line width (and entire whitespace style) is a very easy thing automate with clang-format. I took the time to setup my own .clang-format file and it makes my code so much easier to keep formatted. You'd want to start with changing UseTab
and ColumnLimit
. You also break differently on initializers so take a look at Align and Break options, but you might like how my breaks look. Place the file in your project directory as .clang-format
and run with clang-format --style=file -i $(find . -name '*.cpp') $(find . -name '*.hpp')
. Even easier, install git-clang-format and after adding files to git, run git clang-format
.
I've also gone through and setup KDevelop (my preferred IDE) to run clang-format as the reformatter command. Now I just write my code with long lines and let clang-format break for me automatically.
Wow. That really is a whole other world I'm unaware of. Look at all that functionality. I've never actually used any of the clang tools. I've tended to just rely on vim scripts to do stuff like that. I'll have to read up I guess.
protocol.hpp: Add toBigEndian and fromBigEndian functions which GCC 8.1 optimizes into bswap GCC < 8.1 or clang 6.0.0 only optimize fromBigEndian We could do better, but need to know endianness either with endian.h or C++20's proposed std::endian Use std::copy_n instead of std::copy Add noexcept where appropriate (only on inline or constexpr since C++17 changes ABI)