3 ms·
It's very unusual, but at least it tells a reader what it's an else of. In code-reviews I still occasionally have to complain about the if (condition){
by pilif 11y ago
It's very unusual, but at least it tells a reader what it's an else of.
In code-reviews I still occasionally have to complain about the
if (condition){
// 100 lines of code
}else{
// 20 lines of code
}
pattern.
As we're dealing with a language that has a proper subroutines and a return statement, this can just be refactored away.
But CMake might not have either of those (I don't know - I have only ever written a single trivial CMakeLists.txt), so it might just force this pattern and then it's helpful to also enforce the else to restate the condition.
- cm3 11y agoThat makes sense, though the way this seems to be required to write in CMakeLists isn't maintainable. I can only guess they have diagnostics that would warn if you typo'd that easy to mistype string.