Lightning Talk: Whitespace: A Humorous Short Talk - Dan Curran - CppCon 2023

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

Lightning Talk: Whitespace: A Humorous Short Talk - Dan Curran - CppCon 2023

i want a holy war over whitespace. the most productive discussion.
---

Dan Curran

working in finance. i like to experiment in language design, and implement proposals for c++ in clang. sometimes.
---

---

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

I hate that clang-format default to push everything on the right. There are few options to push things back to the left, but it's several options, and they do not cover every cases. There should be a single option for this preference.

sephirostoy
Автор

Between tabs and spaces, one is obviously superior. So obviously superior that I won’t say which one 😁

AnthonyDentinger
Автор

Nice talk :) I do agree with most, except the return type, that is where you pivoted from super hero to villian ;)

TheMaidenOnes
Автор

Okay, after a few years of working as a (clean-code-loving) C++ developer, watching all of these crazy formatting standards in various code bases (because it's standard LLVM/Google/... style, dude) and suffering from not being able to even configure clang-format to obtain such a nice, clean, intuitive formatting I've started to think that something is seriously wrong with my code esthetics. Thanks for telling me that I'm not the only one 😆

KrzysiekPierczyk-uqdu
Автор

If we're following the patent specification for toilet roll use, surely we should use K&R + C++ standards' formatting? ;)

therealvbw
Автор

There are only two hard problems in CS:
Formatting code and naming things.

AtomicAndi
Автор

Kevlin Henney has an excellent talk from 2016 on this with some discussion empirically determining what's more readable:

I'm not the first person to say so, but I think 80 characters is a good target, but _just a few extra_ is OK if it prevents wrapping. I go with "soft 80, hard 90" for wrapping: if it's less than 90 characters (and readable as-is), it can go on one line, but if you have to wrap, wrap at 80. If you can't _wrap_ at 80 characters, that's a code smell.

That rule plus "functions should fit on roughly 1 screen length, ~50 lines max" has improved my code in every language I've used. It's not so much about the rules themselves as it is about the fact that good code _tends toward readability in the first place._

bloodgain
Автор

5:26 Here really dodged a bullet there by saying TAB_SIZE amount instead of a specific number.

kuhluhOG
Автор

Putting the toilet roll open edge to the back is a perverse as sitting on the toilet while facing the tank/cistern. I mean, why would you do it??

fburton
Автор

I do make sure things end on the same indent as the start, it just makes sense, the return type on its own line was a bit much but I would accept it, however the toilet roll in my house will always be at the back :P

Saragan
Автор

120 characters per line and I'll agree. All on one line is better then what clang does but if EVERYTHING is all on one line bwcause you only have 80 characters per line then it gets cumbersome to scroll.

usrnm
Автор

Not sure if I agree that it’s more readable.
His suggestion reduces horizontal eye movement but it increases vertical eye movement.

ShaunYCheng