Lightning Talk: ClangFormat Is Not It - Anastasia Kazakova - CppCon 2023

preview_player
Показать описание
---

Lightning Talk: ClangFormat Is Not It - Anastasia Kazakova - CppCon 2023

Sometimes things are not what we think of them. But we keep using them based on our perception. ClangFormat is a widely used tool by the C++ community. Join me to explore the typical delusions around it.
---

Anastasia Kazakova

As a C and C++ software developer, Anastasia Kazakova created real-time *nix-based systems and pushed them to production for 8 years. She worked as an intern in Microsoft Research, Networking department, outsourced in Telecom, and launched the 4G network. She has a passion for networking algorithms and embedded programming and believes in good tooling. With all her love for C++, she is now the Product Marketing Manager on the JetBrains C++ tools and .NET marketing teams.
---

---

#cppcon #cppprogramming #cpp
Рекомендации по теме
Комментарии
Автор

My opinion on the main reason for clang-format’s shortcomings mostly boil down to the tool not being opinionated enough. Although the fact it doesn’t use the clang AST was quite surprising.

AdamSweeney
Автор

As one of the maintainers of clang-format this presentation is factually incorrect in a number of areas. Its a low blow on a project
that relies on the good will of a few developers who provide functionality used by 10, 000s if not more.

mydeveloperday
Автор

I was hoping to hear about some alternatives at the end. Any suggestions guys? Also how do I enforce naming style like snake vs camel case? I liked that Java was opinionated on this but seems like C++ doesn’t have single standard.

AI-xijk
Автор

So basically.. clang format has a bug. I'm sure they can fix this specific issue. The only real good argument i'd say is that the clang format config file isn't properly backwards compatible; that is the real annoying part; but just requires some maintenance. I'd take consistent formatting with 1 or 2 tiny mistakes any day over no proper formatting at all.

ruadeil_zabelin
Автор

uses bad code
-> gets bad results

Writing `A < 1 + 2 > (3 + 4)` is a weird way of basically doing `A < 1 || 2 > (3 + 4)`, which is formatted correctly

antonpieper
Автор

When you are making confusion (by using clang format here), you are not helping.

hiftu
Автор

I don't understand the obsession with formatting because 1. there is not one single rule that can be applied everywhere, and 2. we are humans, not robots. Even if you enforce whatever guidelines, everyone still has their own way of doing things. It may actually be helpful if you can see from the style who wrote what code. Autoformatting just throws away all that information.

watchtower