Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The IOCCC is fun, but isn't it time for C/C++ to get standard formatting for consistent readability? Like Go and Python.


There 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.


Honestly, 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.


It has, it is called whatever the company design style says and validated by tools like indent.


Sure, 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/


C++ 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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: