The Community
General Category => Matters of Life and The Universe => Topic started by: Vyn on December 15, 2023, 04:15:41 PM
-
Some of the developers at work today were discussing some of the finer points of using C++, and the topic when I walked up was brace initialization vs. traditional assignation. So, int a{0}; versus int a = 0;. The consensus was that brace initialization should only be used when the possibility of conversion narrowing was present, otherwise the braces make it harder to understand.
I just wandered off, but I got to thinking: its just a symbol. A person has to learn what the symbol means, and then there is no problem. I mean, people have to learn that "=" is an assignment operator, not an equivalency indicator (like a == a), and if they can wrap their noggin around that, what makes {} such a burden that it's better to put forth the extra effort to prognosticate about how one's variable might get stuffed with something bigger than it can hold and then apply braces, rather than just go with the braces across the board.
Spend enough time at it, and a person can easily understand cuneiform. So, why the concern about someone's source code suddenly becoming "hard to understand" if they use those braces?
Fucking programmers.
-
There's more whitespace around a = 0, so from a readability standpoint, that's easier to read. Otherwise, yes, symbols are symbols, no one more difficult than the other, once you've experienced it. After a few days in China, I was reading common Mandarin characters and translating them directly into English, so I knew "exit" from "street", "bathroom", and the directional characters (NSEW and central).
When's the last time we used a 3.5" floppy, yet what is the symbol for "save"? It's the floppy disk in common use at the time the first iconizations of tasks were introduced in programming interfaces. Now, people who have no clue what a floppy is just know "the symbol for save". Other examples come to mind from the world of VCRs...
-
Whitespace, readability...yeah, ok. Did a little digging around, and ran across the joke language called brainfuck.
Talk about readability!
https://en.wikipedia.org/wiki/Brainfuck (https://en.wikipedia.org/wiki/Brainfuck)
(https://cdn.zmescience.com/wp-content/uploads/2017/01/brainfuck.png)
-
Yeah, we're gonna need some comments on that code... :lol: