Skip to Content

Relearning C++

There are a lot of cobwebs in this part of my mind.

Posted on 4 mins read

I have an idea for a software project I want to tackle. I won’t go into great detail about that, other than to say that it’s…uh…a desktop application? ( cough GAME cough ) Anyway, I started thinking about what I was looking for in a programming language/toolchain/ecosystem and came up with the following list of requirements:

  • Good GraphicsTM
  • High performance
  • Can target Windows, Linux and OSX without too many headaches
  • Lots of good libraries available
  • Lots of good tutorials and documentation available
  • Will not be comically obsolete in five years

I know when a lot of you see “desktop application” you just replace that with Electron. There are a number of reasons I’m not doing that, and not just because it doesn’t meet a lot of the criteria on my list there. But that’s another show, as the venerable AB would say.

I’ve done a lot with Go in recent years. It’s a very elegant language and the current toolchain produces reasonably high performance binaries, and it’s getting better all the time. I like Go a lot, and it was a serious contender for this project. In the end I just couldn’t get past the number of things I needed that would require C wrappers that’d I’d have to find or write and debug.

At first I looked at a number of “game engines”, but most of them seemed pretty bloated and overkill for what I wanted to do.

As you’ve already surmised from the title of this post, after much hemming and also hawing, I decided to go with C/C++. (Yes, I know that’s two things and I know the difference. Geez.) I had some exposure to C/C++ back in the Pliocene epoch (during my brief college career). When Java came along it was touted by a lot of important people as the heir presumptive of C/C++. I learned Java and never looked back, but I’ve always felt that so many technologies that came along after C/C++ never quite measured up for some reason or another.

Up until a five or six years ago I had spent most of my career as a backend web developer. I eventually got sick of my available options and sought to get “closer to the metal”. I actually considered busting out (and relearning) C back then and writing a web framework with it. Before I got very far down that road I discovered Go, which did everything I wanted and then some. Go is also spectacularly easy to learn, and I was relatively facile with it in a month or so, and again, I never looked back at C/C++.

Normally I’m all about “good enough”, but this project is an exception. I’m planning to work on this in the background of my day job over the course of a number of years. Because this is my personal project, I really want to spend time writing something elegant and beautiful, at least to me. This means I needed something I’m absolutely sure is going to be around for a number of years to come, which rules out more fashionable technologies, most notably Rust. Rust also has the most annoying and blindly apologist community since Ruby, which puts me off of the whole thing right away.

Relearning C/C++ also has some very pragmatic side effects for my career. I have a sneaking suspicion that WebAssembly is going to be the Next Big ThingTM, and knowing C/C++ will allow me to target that. Yes, I know I can do that with Go or Rust.

More than anything, though, I’ve always felt that I’ve been making excuses to avoid becoming a competent C/++ developer. Hopefully this is the start of the journey to rectify that. Talk to me in a year.

I can already see that a ton has changed since my last look at C/C++. Tools like CMake make my least favorite part of development relatively painless. The language itself is a lot different, though what little I remember is still there.

I should also mention that I’ve decided on GCC, in the form of MinGW on Windows. I normally develop for Linux/OSX, but I figure as the primary target of this thing is Windows, it better work there first, with an option to make it work more or less unchanged elsewhere. Last year I switched my daily driver from Emacs to Visual Studio Code. Visual Studio wasn’t even considered, as that thing weighs in at several dozen gig installed. No thanks.

So here we go. Again. Let’s see if this old dog can learn even older tricks.

comments powered by Disqus