Indenting preprocessor directives provides a significant gain in
readability. We do it for normal if statements, and it makes sense
to do it for preprocessor ifs too.
Details
Diff Detail
- Repository
- rCXX libc++
- Build Status
Buildable 29569 Build 29568: arc lint + arc unit
Event Timeline
a significant gain in readability
To tell the truth, I guess it is subjectively... and rather it is a question of habit IMHO...
Or this style is accepted for libcxx and libcstd and we have to do it for making code consistent ? If yes, I have no objections.
Why do we indent normal if statements? This isn't true for all libraries, but a base library like the standard library tends to have so much preprocessor-level logic that things become really hard to grasp when things are not indented properly. Again, to be clear, it's not about the cuteness of indenting inside a single #if, it's about how to spot matching #endifs when deeply nested.
Or this style is accepted for libcxx and libcstd and we have to do it for making code consistent ? If yes, I have no objections.
libc++ doesn't do this consistently and this has been a source of confusion in the past, in __config where there are many nested #ifs.
I'm in favour of this.
Seems like something we could/should add to libcxx as well then. Might even be acceptable to do in an en masse change there.
I am also in favor of this.
@dexonsmith - libstdc++ also indents it's conditional definitions
Is this something clang-format can mechanically apply?