4 ms·
The IOCCC is fun, but isn't it time for C/C++ to get standard formatting for consistent readability? Like Go and Python.
by org3432 9y ago
The IOCCC is fun, but isn't it time for C/C++ to get standard formatting for consistent readability? Like Go and Python.
- reificator 9y agoSure, but good luck avoiding 927. [1] Go gets away with it because it ships with the official compiler tooling and most projects use it. C++ has 30 years of existing code that follows whatever convention was in vogue + whatever the individual preferred. [1]: https://xkcd.com/927/ https://xkcd.com/927/
- org3432 9y agoC++ projects I work on just require you to use a current compiler, or an older one if the project is older. So seems like 927 might not be as big an issue.
- hedora 9y agoHonestly, most modern C/C++ software has converged to readable formatting. Before that ~C99 it was a crapshoot, but that was 18 years ago! I'm sure python fans will disagree, but the fact that whitespace errors don't effect the correctness of C/C++ code is a feature in my book.
- boterock 9y agoThere is clang-format, which comes even with clang for windows, I use it with a Visual Studio extension and it formats the code whenever I save. I even prefer that sometimes I have the whitespace messed, but just having the braces right will format it properly, where in python you would have to fix whitespaces manually.
- pjmlp 9y agoIt has, it is called whatever the company design style says and validated by tools like indent.