logoalt Hacker News

bee_riderlast Sunday at 7:57 PM3 repliesview on HN

C will outlive all of us.

C++… I don’t know it well. But I’ve heard there are a lot of different dialects, to the point where it is possible that two C++ programmers might be writing in essentially different languages. How “old” is the language, in that case?


Replies

t0mpr1c3last Sunday at 8:37 PM

I've been writing C++ for embedded systems the past year or two.

We use a very conservative subset of C++, almost like C with inheritance. We barely even use templates. We try to avoid allocating on the heap. The code is mostly imperative.

Since 2011, a lot of new language features have been introduced. The ones we use are things like smart pointers (that improve lifetime management) and some tweaks for better type safety.

It is said that moden C++ enables a functional programming style. I have never actually seen anybody code that way (it would be hell to write and worse to read) but that could just be the niche I'm in.

What is undeniable is that C++ is so complex and has so many features that you have to choose a subset of the language to enforce a consistent style.

Also a lot of the STL (standard library functions) are deprecated in one way or another, which is a real minefield.

pjmlpyesterday at 8:59 AM

All modern C compilers are written in C++.

C also has dialects.

show 1 reply
AlotOfReadinglast Sunday at 8:24 PM

The dialects issue is why I avoid interviewing in C++, because inevitably it turns out the interviewer has some weird view of what "C++" is and doesn't realize it. Years ago I had an interview in "C++14" that required std::optional (C++17) as implemented by a C++14 compiler with only experimental, nonstandard support. In another case, an interviewer on the LLVM team vehemently disagreed with me that you could legally implement std::atomic types with mutexes, as I was going over a story about fixing issues in an awful stdlib that implemented them with mutexes.

This kind of thing doesn't happen when I interview in other languages.

show 2 replies