I would be fine with both as long as it's explicit. I still find the rationale that struct and class should be formatted similarly, it's harder for me to explain why struct is more like a for loop than a class...
85'849 lines
I have no idea what these numbers mean, I checked same-line opening braces with
% grep -E '^\s*\bstruct\b\s+[^;{]*\{' --include="*.h" --include="*.cpp" -r src/ | wc -l
393
and quickly vibe coded a script that does newlines:
<details>
<summary>vibe-Details</summary>
#!/bin/bash
echo "Analyzing struct brace placement in Bitcoin Core..."
# Count same-line braces
same_line=$(grep -E '^\s*struct\s+[^;{]*\{' --include="*.h" --include="*.cpp" -r src/ | wc -l)
# Count next-line braces using awk
next_line=$(find src/ \( -name "*.cpp" -o -name "*.h" \) -exec awk '
/^[[:space:]]*struct[[:space:]]+[^;{]*$/ {
struct_line = NR
getline
if (/^[[:space:]]*\{/) {
count++
}
}
END { print count+0 }
' {} \; | awk '{sum+=$1} END {print sum}')
echo "Structs with same-line brace: $same_line"
echo "Structs with next-line brace: $next_line"
echo "Total: $((same_line + next_line))"
</details>
which vibe-revealed:
Analyzing struct brace placement in Bitcoin Core...
Structs with same-line brace: 393
Structs with next-line brace: 223
Total: 616
So the counts don't really matter in my opinion, we have a few hundred of each, there's no clear winner based on usage, let's come up with better arguments for either.