Live data from Hacker News

Modern C++ Programming Course

github.com

31–40 of 221 posts

Re: Modern C++ Programming Course

#31

[flagged]

Genuinely asking: Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter? This makes me sad. Programmers have the knowledge base to make some of the most sophisticated things bend to their will, and they tell a programming language is bad, because they can ma…

The fact that we now have languages enforcing safety makes them more desirable than a language that doesn't.

If I'm writing a small toy project where I'm the only person messing with the code, I can totally do it in C, or even raw assembly if I feel like it.

If anyone else will ever write to the same codebase, or the code is for a client/company, I want every automated static check I can possibly have.

Re: Modern C++ Programming Course

#33

[flagged]

Genuinely asking: Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter? This makes me sad. Programmers have the knowledge base to make some of the most sophisticated things bend to their will, and they tell a programming language is bad, because they can ma…

Look at it this way: every hour, people are coming across C++ for the first time. You can’t expect them to have the same discipline as seasoned programmers. The thing is that even if you teach them “the way”, there’s always a new batch who is clueless. You’re never going to get rid of them, and even the experts are going to make mistakes and take shortcuts.

Better to have sane strict defaults with an escape hatch for experts rather than an open range filled with footguns for any newbie to pick up.

Re: Modern C++ Programming Course

#34

I picked C++ back after a long break and I have to say in reasonably recent iterations (like C++17) it's good enough, although OOTB Unicode is a PAIN. They should have solved it in C++11 and moved on. It's a disgrace.

Does Carbon or c++next fix the ootb handling?

Re: Modern C++ Programming Course

#35

[flagged]

Visual Studio will yell at you if your code isn't conforming to the "C++ Core Guidelines" (those guidelines basically define what "Modern C++" even means). Unfortunately it also yells at you when your *C* code violates the C++ Core Guidelines (at least it was a few years ago when I permamently switched that "feature" off).

It still does, given Microsoft's stance on security, and that C++ used to be the main systems language, hence why C support languished until pressure from relevant customers to pick it up.

I say used to be, given the recent announcement of Azure business unit to switch to Rust as the favoured systems language for new engineering activities.

Re: Modern C++ Programming Course

#36

Earlier quoted context omitted.

> Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter? Why would I want to? Most of that is boring stuff that's hard to get consistently right and highly amenable to automation. Automation is what the computer is good at, it can have that job. Like, why wo…

> Automation is what the computer is good at, it can have that job. Pre-commit hook is automation. It formats the code and gives you linting notes the moment you write "git commit". > Like, why would I want to spend more mental bandwidth on tracking down whether every new goes with every delete than strictly necessary? It's not more mental bandwidth for me. Because I write the new , and directly delete at the point I…

> It's not more mental bandwidth for me

Most people are not you. Which, I guess, also answers your original question of "Why many programmers [do the things not they way I would do]?". Incidentally, this is also the root of all the complexity in managing and coordinating people.

Re: Modern C++ Programming Course

#38

[flagged]

Genuinely asking: Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter? This makes me sad. Programmers have the knowledge base to make some of the most sophisticated things bend to their will, and they tell a programming language is bad, because they can ma…

[deleted]

Re: Modern C++ Programming Course

#39

[flagged]

Genuinely asking: Why many programmers need tools to enforce something upon them? Why not they can't take slow, be mindful about what they write and add a couple of layers as pre-commit hooks? Like a code formatter and maybe a linter? This makes me sad. Programmers have the knowledge base to make some of the most sophisticated things bend to their will, and they tell a programming language is bad, because they can ma…

The biggest problem with C++ isn't that you can't write clean, structured code with it.

It's that the language is so vast that the odds of any two developers working on two different projects agreeing on what that means are low. I programmed in C++ for a decade, then for a year or two at a second place, then picked it up again in a third... And all three places had nearly completely different best practice protocols. Pre-processor macros are banned, but deep template abstraction and CRTP abounds. Interface and implementation are separated even when templates demand they be in the same header chain, but here we do so by squirreling away the implementation in a separate file with a non-standard suffix instead of splitting it out but keeping it in the bottom of the same file. In my previous company, we used pointers to indicate the called function could mutate the data... In my new firm, pointers in interfaces are just about banned unless absolutely necessary and we indicate whether data could be mutated via const and documentation.

The language is broad enough to let the developer change almost anything, but it is unfortunately broad enough to let competent developers build competing and equivalently (un-)safe styles.

Post reply on HN