Live data from Hacker News

I learnt C++ in 2018 and have no regrets

vishnubharathi.codes

171–180 of 259 posts

Re: I learnt C++ in 2018 and have no regrets

#171
post #134

Earlier quoted context omitted.

That's an availability bias. While cmake is common in commercial settings, I haven't seen autoconf used outside of open source. I've seen scons and meson both used as well at various companies. Meson seems to be spreading pretty rapidly. After I was introduced to it a few years ago for work, I started using it as my default build system for C++ elsewhere and more C++ devs I know have started using it. I've seen it re…

Why would one use menson over cmake ?

Meson is much easier to use and configure for C++, being quite obviously designed specifically with C++ builds in mind. It automagically does the right thing for setting up most C++ build environments by default with virtually no config or quirks you need to learn. It is built on top of Ninja, and generally very fast and efficient. The only real knock against it is that the documentation isn't as good as could be, and it is evolving quickly, but the fact that it often "just works" doing the obvious thing makes it less of an issue. In my experience, setting up a cmake environment has a significantly steeper learning curve and is more work.

The tradeoff is that Meson takes a fairly rigorous "one correct way" approach to how you organize your builds. It doesn't prevent you from doing anything functional but what it forces you to do is very sensible, minimizes the potential for issues in diverse environments, and reduces the degrees of freedom Meson has to sort out. A prohibition on unfettered creativity, advisable or not, in how you manage your builds has turned out to be a blessing in my experience because it codifies what are very arguably best practices in code and then makes it easy to implement them.

I'm fairly agnostic on build systems -- I've probably used a dozen -- but Meson, even in its relatively youthful state, is the best C++ build system I've used so far in terms of getting things done quickly in a maintainable way that is easy to use for average programmers.

Re: I learnt C++ in 2018 and have no regrets

#172

Earlier quoted context omitted.

I ran into this trying to get into it about 3 weeks ago. I'm so used to things like npm, ruby gems, go packages, pip that it felt like a huge task just to get something built or settle on a way for me to build mine. Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. I wish I had stayed with it since college b…

> Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. Honestly this is something that apt (et al.) make so easy on Linux distros that when you move to Mac or Windows you just have hard time believing people still in 2018 have to _deal with this shit_ (installing libraries and their headers by downloading each…

For what it's worth, I develop almost exclusively on Ubuntu, but built-in package management is no panacea.

You get one version of each package, and it is often years out of date. If you need a newer version you'll have to install it yourself and then try to navigate how to get your projects to use your local version. For any popular package that is still undergoing a fair amount of change it is likely that eventually some project you want to build will need a newer version than the one your distro provides.

So you still need a solution to the versioning problem separate from the distro packaging environment, at least for development.

Re: I learnt C++ in 2018 and have no regrets

#173
post #66
post #52

Earlier quoted context omitted.

Most projects use CMake now so it seems the community is starting to coalesce around CMake as the "not official" build system.

Thats besides the growing number using Meson instead.

Meson seems to be more of a thing in certain Linux circles (e.g. Gnome/Freedesktop, but not KDE), but outside of that CMake seems reign supreme.

Re: I learnt C++ in 2018 and have no regrets

#174
post #156

Earlier quoted context omitted.

Wouldn't the main definition of OOP be defined as merging data and functions into a single unit? When using libraries, I find this concept unavoidable for UI and games. I agree though, that having the entire program be a graph of objects is actually usually the worst pattern.

Not really. In fact in Lisp OO is the opposite, the functions are explicitly keeped away from the data. For Alan Kay it was all about messanging but I dont think most people think about that. Structs with some kind of dynamic dispatch based on the type would be the most general discription I think.

Are you saying instead of this:

  def method():
    this.value = this.value + 1
lisp does something like this?

  def method(object):
      object.data = object.data + 1

Re: I learnt C++ in 2018 and have no regrets

#175

I also used 2018 to learn and get proficient in C++. Honestly, I don’t really like it. The only real reason for that is that using smart pointers is verbose, but I don’t want to do manual memory management where it’s possible to instead rely on RAII. Ironically enough, though, C++ is probably the second of two languages I’d consider my “go to.”

You dont go from beginner to proficient in any language in 1 year, much less C++.

Re: I learnt C++ in 2018 and have no regrets

#176
like let me read the source code of a open source software today

To me, this is the most powerful reason to learn C and C++. If you know these languages, you can read the codebases of all the things you use and contribute to them (every browser in existence, every Unix in existence, most user space tools, many GUI tools, many low-level libraries that mobile apps use).

Even if everybody stops writing C/C++ today, you'll still be using software written in C/C++ for decades.

And of course, that's a joke -- there's still at least 10x more C/C++ being written every day in the world than any other language that compiles to native code (Rust, Go, etc.)

Re: I learnt C++ in 2018 and have no regrets

#177
post #74

> Within C++ is a smaller, simpler, safer language struggling to get out.” - Bjarne Stroustrup Ah, yes. I think they called it "C".

C compatibility was the very reason for which C++ is bigger, more complicated and less safe than a similar language not compatible with C could be.

Objective C and D both have excellent C compatibility. C# has very good one. I think all 3 languages are easier to use.

Re: I learnt C++ in 2018 and have no regrets

#178

Earlier quoted context omitted.

You shouldn't make broad statements like that. In my personal experience, I have found Javascript much easier than C++. If I want to install a package, I can just do "npm install Now, I'm sure some people have an easier time with Makefiles, but I've found it even easier to get up and running in Javascript. Most of the tools in Javascript (create-react-app, Webpack, etc.) are very user friendly, making setup trivial.…

I'm reading this because I'm about to move back to systems programming after a 6 year journey into Javascript Nodejs full-stack developement. Don't underestimate the pile of garbage JS indeed is! Yes, you can install a package with ease, you'll have to do that with about 100 packages that keep changing all the time with all kinds of breaking changes (not talking about their 1000's of dependencies). I'm also sick and…

I'm not too worried about the constant "framework hype". Although there are many frameworks, React is a solid option that remains relatively dominant. Yes, others exist like Vue and Angular--but I can be pretty confident that React isn't leaving anytime soon.

Similarly, with C++ there are also many packages to do the same thing. This summer I was using TLS and I found a variety of options, OpenSSL, mbedTLS, wolfSSL, etc. etc.

I do agree that it is tiring to learn some of React's accessories. I have never used Redux and when I do need some form of global state management, I think I will use MobX.

The complaints about code base quality and "stupid e-commerce websites" don't seem to be problems inherent to Javascript, although I suspect the problems Javascript solves are less interesting than the ones C++ solves.

All in all, I feel like C++ (for me) has been more difficult than Javascript due to a lack of standardization and the community being less beginner friendly.

That being said, I was trying to use a relative obscure feature (SGX) in C++, whereas with Javascript I stick to relatively mainstream applications.

Re: I learnt C++ in 2018 and have no regrets

#179

Earlier quoted context omitted.

I've been in the same boat--relearning C++ after using C++98(!) for a long time. My first go-to book was _A Tour of C++_ , 2e by Stroustrup. Also _Effective Modern C++_ by Scott Meyers (of _Effective C++_ fame). Other books I've been reading: _C++ 17 The Complete Guide_ by Josuttis _C++ 17 in Detail_ by Filipek Lots of good blogs out there. Also the CPP Podcast. http://cppcast.com/ There are also a lot of great blogs…

More of a meta-comment, but the underscores you used to presumably get markdown italics should actually be asterisks on HN. Normally it doesn't make a readability difference but trying to parse the book names from your post was a tad mentally painful. Took me a little while to realize the asterisk v. underscore thing so I thought I'd pass it on. Note: I do wish HN would adopt standard markdown

Oops. Sorry. I had completely forgotten HN markdown. I usually use the underscores around book titles with cleartext in mind. I'll remember asterisk in the future.

Re: I learnt C++ in 2018 and have no regrets

#180
post #167

I studied C++ during university days and after that I never got a chance to learn it seriously due to my job commitments as a web developer. I did work on C# but not C++ professionally. I always admired my friends who could write good C or C++ code. So many times I wish to learn it seriously but these new editors for web development and Python made me lazy enough that I wish to have some environment and way to write…

I had the same problem and I decided on start building a few Qt apps for command line tools I had made. This worked quite well for me because it wasn't too complex or large, you tend to write in a 'modern' style (although the downside here is I guess that qt is also somewhat idiosyncratic) and you get a build tools so you don't need to worry much about that.

I forgot to mention that I did work on Both QT 3.x in the last decade. I liked it because I was working on VB at that time and was dying to find something similar for Linux(Was exploring RH those days). It did not help me to improve C++ though.
Post reply on HN