Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use clang-format

📅 2020-Mar-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ clang ⬩ 📚 Archive

clang-format is a tool that can be used to format C++ code to match a coding style.

$ sudo apt install clang-format
$ clang-format foobar.cpp

This formats the lines in the input file and spits out the formatted lines to stdout.

$ clang-format -i foobar.cpp
$ clang-format -style=file foobar.cpp

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧