Live data from Hacker News

Modern C++ Programming Course

github.com

191–200 of 221 posts

Re: Modern C++ Programming Course

#191
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.

This is maybe a very unpopular opinion, but if you go from C to a higher level language, I would advise to steer away from C++, certainly if it's would be your first OO language.

Re: Modern C++ Programming Course

#192
post #188

Earlier quoted context omitted.

> You should almost always be using unique_ptr or shared_ptr I really wish there was a thread unsafe version of shared pointers, without atomics overhead, in the standard. Maybe without weak pointers.

If there's one thing C++ needs, it's more slightly-different varieties of smart pointers in the standard. ;-) What exactly would you use these for? I find that usually I can get away with unique_ptr for the sort of object that I have many of where pointer performance matters.

Some sort of problems where you throw trees around. Almost interpreter like programs, where trees are arbitrarily stored on different places. And where you for some reason don't want a proper GC ...

Re: Modern C++ Programming Course

#193
post #53

looks good,is there one pdf for all chapters?

I have cloned the repository then combined the chapters using pdftk: pdftk *.pdf cat output Modern_Cpp_Programming.pdf

This worked on the Mac. I had to install pdftk (brew install pdftk-java) first. The result is nicely formatted for reading on an iPad after importing into Books.

Re: Modern C++ Programming Course

#194

I've been setting up my little docker image that has both llvm/clang/tidy/clangd and gcc inside with boost with an idea I'd run it and from outside use it to code with live checking and compiling without littering my OS. Now, I feel like I'm doing something that already exists but couldn't really find what everyone use, ought of those that would prefer such a setup. Debugger within is probably a pipe dream, but who k…

VS Code is designed to work with these - https://code.visualstudio.com/docs/devcontainers/containers

Interesting, thanks for that. That's kind of the idea, but preferably without the 'extend' part on top of containers. I'm not using VSCode though so I'll shop around or maybe I'll convert, who knows.

Re: Modern C++ Programming Course

#195

I've been setting up my little docker image that has both llvm/clang/tidy/clangd and gcc inside with boost with an idea I'd run it and from outside use it to code with live checking and compiling without littering my OS. Now, I feel like I'm doing something that already exists but couldn't really find what everyone use, ought of those that would prefer such a setup. Debugger within is probably a pipe dream, but who k…

Maybe nix ( https://github.com/NixOS/nix ) is a better tool for what you're looking for if you're on Linux, you can setup nix shells and work in them, what's installed inside the shell won't be accessible from outside.

As is with most people and nix, it's on todo list to check it out. This might be the trigger. Thanks!

Re: Modern C++ Programming Course

#196
post #189
post #176

Earlier quoted context omitted.

I think you missed exceptions often being a problem in low level and embedded targets. That knocks out most of STL anyway. I also think you are a bit harsh on virtual functions - it introduces a single indirection, yes, but sometimes that is fully justified. RTTI on the other hand... of course depends a bit on target characteristics. Perhaps controversial, I've also found (especially bare) lambdas and even std::funct…

You can use quite a lot of STL even with -fno-exceptions. Things that you probably need to ditch are: std::vector std::list std::map std::unordered_map std::set std::unordered_set std::sort std::transform std::merge std::string std::regex std::swap std::function std::stable_partition But there are much more than that in STL.

True: "most" was a stretch.

Re: Modern C++ Programming Course

#197
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.

1) Real-Time C++ by Christopher Kormanyos. - For using C++ in embedded systems. 2) Software Architecture with C++ by Adrian Ostrowski and Piotr Gaczkowski. - Gives the overall picture of how to use C++ plus relevant modern tools as a complete development system. 3) The C++ Programming Language by Bjarne Stroustrup. - The bible/reference with programming techniques for the language. Learning C++ is not difficult and d…

[deleted]

Re: Modern C++ Programming Course

#198
post #181

Earlier quoted context omitted.

If you can't use the STL because of exceptions: https://www.etlcpp.com/

Sure, there are more embedded friendly libraries, but that wasn't the topic.

It’s almost as if this is some sort of discussion board where people can expand on the topic as they see fit :D

Re: Modern C++ Programming Course

#199

One thing that would have helped me when I started learning C++ was learning the C++ compilation model i.e. translation units. It is surprising how many people look surprised (that also claim they know the language) when you tell them that code in .cpp does not get inlined into other .cpp files no matter what doing compilation. (yes the linker can (and should) do that with LTO doing linking)

Compilation units are mainly about symbol visibility and as you already realized at the end of your comment don't have anything to do with inlining as far as the C++ standard is concerned. Neither does the inline keyword btw. The linker doesn't inline anything, LTO/LTCG is about running (part of) the compile process at link time. But that's really no concern for the C++ code but an implementation detail of the toolch…

yes, LTO itself does not inline but from a user point of view it does, and that is exactly my point. If you are a beginner and you do not come from C, then you might not think about these things (maybe you do I did not).

I get that it is just an implementation detail, but so are many things in C++ and you usually care about these things otherwise you would not be using the language in the first place.

Many projects also disable exceptions that is also an 'implementation detail' (or at least something that is definitely not required by the standard I would imagine), but now you are technically not writing C++ anymore.

I guess this is also one important thing when learning C++. The community is very fragmented, and there seems to be disconnect between C++ users and committee.

Re: Modern C++ Programming Course

#200
post #130

What is the C++ job market like? I do mostly Python / web app developmnt, but I don't like the churn.

Having “spent some time in the job market lately”, the salaries seem astronomical if you’re C++ and fintech/HFT. I think some funny business is going on with those listings though… Kinda average in game development and sadly pretty low in embedded systems. All way less common than your average Python position, but probably way more interesting.

I'm not sure if you're in this field specifically, but since you mentioned it I'll ask. Is it your impression that fintech and HFT shops would possibly start to transition to Rust?

I've always heard that they're currently mostly using C++ (and sometimes Java). But I'm not sure how dogmatic or change-averse they are on average.

Post reply on HN