Live data from Hacker News

C++ Cheat Sheets

hackingcpp.com

41–50 of 82 posts

Re: C++ Cheat Sheets

#41
post #5

Earlier quoted context omitted.

* Compile with clang, link with mold or at least lld. mold can link gigabyte-sized binaries in, like, one second * Use ninja instead of make * Use PCH * -gsplit-dwarf

Off topic. Could you recommend an ide to work with c++?

vim with the YouCompleteMe plugin (which uses clang-complete) is pretty good.

Contrary to a sibling post eclipse CDT is fine (especially with vim bindings).

It depends what you want from your IDE maybe?

Re: C++ Cheat Sheets

#44
post #5

Earlier quoted context omitted.

* Compile with clang, link with mold or at least lld. mold can link gigabyte-sized binaries in, like, one second * Use ninja instead of make * Use PCH * -gsplit-dwarf

Off topic. Could you recommend an ide to work with c++?

qt-creator is a nice open-source IDE:

https://github.com/qt-creator/qt-creator

They offer binary releases, but it's also possible to compile from source without too much trouble. Written in C++, it's pretty snappy. Supports meson.

Re: C++ Cheat Sheets

#45
post #43

Quoted post unavailable.

It does not make sense if you think you have to learn every single function in a language's standard library. And if you think you have to, you are thinking wrong of a language like C++. This sheets are just a summary of what a language is capable of, you don't have to memorize every library function just look up what you need.

Re: C++ Cheat Sheets

#47

Probably semi related, but when I was looking at C/C++ job offers, why are they paid so little in comparison to Python or JavaScript? It seems like C/C++ is much more complex. I was mainly looking at embedded stuff vs Web. For example senior C++ role was paying £45k pa on average and over £60k for JS.

Difficulty of a job isn't a great metric to evaluate pay/salary, if that were the case then miners or gravediggers would be among the wealthiest people in the world. Salaries often have to do with marginal revenue productivity and from that metric, C++ is not a particularly productive programming language compared to its cost.

C++ is a very error prone, complex and risky language and even when used in industry, it's used in such a way that companies significantly restrict its feature set to a mostly sane subset of the language that in many cases looks like a dialect of C with classes. The benefit of using it is your product has the potential to outperform software written in other languages, but this benefit often comes at the cost of software that is more limited in features compared to competitors.

For some domains, like HFT, audio and graphics, where performance is the primary feature C++ does pay well, but for most other domains the sheer complexity of the language outweighs any benefit to productivity.

So ultimately the reason Python developers get paid more than C++ developers is because products developed in Python are more productive than products developed in C++. The reason for that difference in productivity is that given two developers who are both investing X units of time working a product, the Python developer is far more likely to spend that time adding new features to their product while the C++ developer is likely to spend that time trying to find the cause of some random bug due to undefined behavior, or trying to figure out some arcane and complex language quirk.

Re: C++ Cheat Sheets

#48
post #43

Quoted post unavailable.

Everything is simple once you know it. The struggles I have with python would be hilarious if it wasn't so frustrating.

Not saying that C++ isn't much, or has lots of baggage.

Re: C++ Cheat Sheets

#49
post #2

Wow, this is really good, there are still things I can learn. C++ really has a lot of good things. It's just a shame it's so slow to compile. I'm curious if anybody is working to make C++ faster to compile. Even if it was a subset of the language, with some features removed, it would be good enough for me.

> I'm curious if anybody is working to make C++ faster to compile. Yes - C++20 added support for modules to the Core Language (both "header units" and "named modules"; header units are an intermediate step between classic includes and named modules), and support for header units to the Standard Library. Compiler/library support is a work in progress (MSVC's STL, which I work on, is the furthest along - see https://gi…

Still looking forward to a solution for _ITERATOR_DEBUG_LEVEL in release builds with modules, VS DevCommunity ticket does exist.

Currently it appears anyone that cares about bounds checking and iterator validation in release builds, has to keep using global module fragments.

Re: C++ Cheat Sheets

#50
post #33

Probably semi related, but when I was looking at C/C++ job offers, why are they paid so little in comparison to Python or JavaScript? It seems like C/C++ is much more complex. I was mainly looking at embedded stuff vs Web. For example senior C++ role was paying £45k pa on average and over £60k for JS.

If it says "C/C++", it means they don't even know what they want, and might even be satisfied with a cave-dwelling C coder. The highest-paid programming jobs are mainly held by C++ programmers, many of them in service of financial gambling. That work shades over into FPGA and HPC programming at the high end. A skilled C++ programmer at these shops can get a half $million, some more.

"C/C++ Users Journal" - https://en.wikipedia.org/wiki/C/C%2B%2B_Users_Journal

You are certainly acquaited with it.

Post reply on HN