Live data from Hacker News

Modern C++ Programming Course

github.com

21–30 of 221 posts

Re: Modern C++ Programming Course

#21

[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).

Many of the "Core Guidelines" are semantic requirements which are (provably) Undecidable, so even if tooling was created for them the tooling would necessarily have either false positives or false negatives (those are the only options, unless "both" counts as another option). In practice most of these are unaddressed, Microsoft understandably focused on checks which are never wrong and give actionable advice.

"Guideline support" does include libraries with classes that e.g. provide a slice which raises an exception on bounds miss, which is something, and it's certainly notable that the equivalently named C++ standard library feature is a foot gun† whereas the one in the guideline support library is not, so that's a good reason to adopt this. But VS does not in fact ensure you obey all the guidelines, it's very much a "best effort" approach even with that switched on.

† WG21 (The "C++ Standards Committee") seems to have concluded that because sometimes the fast way to do something is unsafe, therefore the unsafe way to do something must be faster... as if car executives noticed that 240mph crashes in their flagship sports car were often fatal and concluded that if they re-design their under-performing SUV so that the fuel tank explodes during any collision killing everybody aboard that'd improve its top speed...

Re: Modern C++ Programming Course

#22

[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…

First of all: I am failable. I do make mistakes, even if I concentrate. Secondly I want to verify code others wrote. If a tool does the first pass quickly and automatically, I can quickly ensure some basic level of compliance and can focus on the relevant part.

In the end it boils down to: Let the computer do what a computer does and do the things a computer can't.

Doesn't say, one shouldn't think, but computers are there and are powerful, so use it. If the checker doesn't find anything: great. If it does: good it's there.

Re: Modern C++ Programming Course

#23
post #13

Any ideas where to start learning C++ as an embedded developer? I wrote many lines of bare metal C code and want to transit to higher level jobs. I see many expensive or completely free courses, but I am not sure which one is usable in my complicated situation.

Well, you seem to be precisely the target audience for the course linked in this very post:

    > This open-access course is directed at those who are already familiar with C 
    > and object-oriented programming towards a proficiency level of C++ 
    > programming.

Re: Modern C++ Programming Course

#24

Earlier quoted context omitted.

> Pre-commit hook is automation. It formats the code and gives you linting notes the moment you write "git commit". So isn't that a tool that enforces something upon the programmer? > If I botch something, valgrind will tell me, even pinpointing it with line number. What is the benefit of needing valgrind? Isn't it even better to have the task automated away so that the problem doesn't even come up?

> So isn't that a tool that enforces something upon the programmer? It's a tool I voluntarily add to my workflow, which works the way I want, when I want, according to project needs. It's not a limitation put upon me by the language/compiler/whatnot. > What is the benefit of needing valgrind? Isn't it even better to have the task automated away so that the problem doesn't even come up? In most cases, performance (thi…

> It's a tool I voluntarily add to my workflow, which works the way I want, when I want, according to project needs. It's not a limitation put upon me by the language/compiler/whatnot.

I spent a lot of time maintaining a lot of Perl code. While it was generally very well written, it also made me a big fan of strict, demanding compilers. Perl is quick to write, but can have very high debugging costs since it'll let you get away with a lot that it shouldn't like having a function called with arguments but that completely forgets to retrieve them.

Based on my experience, IMO any class of error that can be eliminated, should be.

So my modern approach is -Wall, -Werrors, -Wextra, and anything else that can be had to that effect, all the time.

Re: Modern C++ Programming Course

#25

[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…

Software development for at least the last 20 years has been about cranking out code.

Re: Modern C++ Programming Course

#28
"A Little History of C 3/3" says that C was used in the special effects for Star Wars. I do not know what relevance this has, honestly, but independent of that is the strange choice of photo: an image from the Empire Strikes Back which shows stop-motion models with optically-composited, rotoscoped lasers. Excepting that this may be from the digitally recomposited Special Editions, no C code was used in the making of this shot.

Re: Modern C++ Programming Course

#30
post #13

Any ideas where to start learning C++ as an embedded developer? I wrote many lines of bare metal C code and want to transit to higher level jobs. I see many expensive or completely free courses, but I am not sure which one is usable in my complicated situation.

If you want to understand the C++ in terms of C code then probably you would need to understand the C++ object model. I mean, how C++ classes are translated into C equivalent code. If you are interested in these you can take a look at a tutorial I wrote long back https://www.avabodh.com/cxxin/cxx.html

If you want to write bare metal C++ then this page from the above tutorial will be useful https://www.avabodh.com/cxxin/nostdlib.html

Post reply on HN