Live data from Hacker News

C++ Cheat Sheets

hackingcpp.com

61–70 of 82 posts

Re: C++ Cheat Sheets

#62
post #43

Quoted post unavailable.

Why do these types of comments come up in every thread about C++? Sometimes people who like C++ just want to talk about C++ on the internet. It doesn't have to be for everybody.

Just flag and move on. There is no point to be dragged in flame wars for every C++ submission.

Re: C++ Cheat Sheets

#63
post #43

Quoted post unavailable.

Your criticisms of C++ are correct. The language is janky to use and filled with edge cases. The standard library is designed by implementers to make most things possible but few things easy (std::string::contains will be added in C++23 yay!). And using the same-ish iterator interface for vectors and hashmaps results in needlessly unsafe and verbose vector methods (foo.bar[index].insert(foo.bar[index].end(), ...)) and great difficulty implementing hashmap iterators that act like pointers.

Nonetheless the cheat sheets largely do not reflect these issues, but the breadth of functionality C++ supplies. span and string_view are simple and elegant (aside from lifetime errors caught by Rust). Personally I think algorithms try to do too much, and it's not like other languages could cram in binary search, heap algorithms, reduce, scan, permutations... in a "simple, intuitive fashion", though duplicate functionality between iterators and ranges is a problem. Arithmetic conversions and promotions were a mistake (inherited from C) though, and lambda captures and mutability are complex. Reference collapsing has a simple slide but confusing semantics. I'm not sure I see any structured bindings either (these interact poorly with lambda captures lol).

Re: C++ Cheat Sheets

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

* 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

All good suggestions. I might add: ccache and distcc to speed up full rebuilds.

Re: C++ Cheat Sheets

#65
post #32

Earlier quoted context omitted.

Is clang still faster? I thought it had slowed down in the past decade and was now worse than GCC.

For my own projects at least it is, by 10-20%

Had the same experience. It is not a huge difference, but it is noticeable, especially in the incremental edit-build-test cycle.

Re: C++ Cheat Sheets

#66

Also, if you do not use Dash or an open source implementation like Zeal[1] (which is what I use), you are missing out. The supplied C++ docset comes from cppreference.com and is very, very useful to have to hand. The Python and CMake docsets are also particularly useful to me. [1] https://zealdocs.org/

I wish Zeal made it easier to inject custom CSS based on the current docset (like Stylus in a browser lets you inject different CSS per domain), or change the zoom level independently for each docset. One pet peeve of mine is fonts I dislike or find too small/large, and browsers currently have better tools for customizing reading.

Re: C++ Cheat Sheets

#67
post #50
post #33

Earlier quoted context omitted.

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.

It has been literally decades since I last encountered it. In any case the title has exactly nothing to do with job listings or what may be inferred from them.

Re: C++ Cheat Sheets

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

In the old days C++ pre-processed into C. Then you had to run a special linker to handle how the preprocessor created class part names.

I thought that the old point of C++ mangling was that it could use existing linker tech. Do you have some references?

Also, my understanding is that, except for the very first few prototypes, starting from cfront on the C++ compiler was a real compiler. It just happened to target C instead of asm.

Re: C++ Cheat Sheets

#69
post #43

Quoted post unavailable.

It's because this cheat sheet goes in depth. That's why it's so many pages long. I would expect what you compare to does not delve into in-memory layouts of vectors and random distributions because they usually don't.

This looks aimed more for computer science students or mathematicians wanting to quickly adapt pseudeo code to C++ more than a novice wanting to see what C++ is about.

Re: C++ Cheat Sheets

#70
post #67
post #50

Earlier quoted context omitted.

"C/C++ Users Journal" - https://en.wikipedia.org/wiki/C/C%2B%2B_Users_Journal You are certainly acquaited with it.

It has been literally decades since I last encountered it. In any case the title has exactly nothing to do with job listings or what may be inferred from them.

Ok, lets get job listings then, from companies whose staff seat at ISO C++.

"Senior C/C++ Software Engineer" @ NVidia

https://nvidia.wd5.myworkdayjobs.com/en-US/NVIDIAExternalCar...

"Senior Software Engineer" @ Microsoft

https://careers.microsoft.com/us/en/job/1152962/Senior-Softw...

> Experience using scripting languages such as bash, Python, and PowerShell, or compiled languages such as C/C++, C# and Go are most relevant, but others are acceptable

"Software Engineer, Core, Compilers, Runtimes and Toolchains" @ Google

https://careers.google.com/jobs/results/72312064984392390-so...

> Experience with software development using C/C++.

"Software Developer (C/C++)" @ Apple

https://jobs.apple.com/en-us/details/200287299/software-deve...

"Software Developer – C/C++" @ IBM

https://careers.ibm.com/job/14295385/software-developer-c-c-...

"Principal Software Architect : C/C++/GPU" @ AMD

https://jobs.amd.com/job/Markham-Software-Development-Engine...

"Senior Compiler Engineer" @ ARM

https://careers.arm.com/job/cambridge/senior-compiler-engine...

> Excellent programming skills in C/C++

Better not keep using programming languages tainted by quality standards of all ISO C++ member companies.

Post reply on HN