C++: I’m not coming back

For a long time my primary language was C++. I know this is uncommon for someone of my age (21) but C was actually the first language that I learned. (Keep in mind although this wasn’t that long ago, it was hard to find good advice online so I bought a book on a language I’d heard was commonly used and spent a couple months digging into C.)

When I went to college I had to learn Java, on my own I got into Perl, Python, and Lisp. I fooled around with PHP, learned to respect Javascript as a real language, and even wrote some Ruby. When it came time to explain what I did to my then-girlfriend it was Python not C++ that I helped her write a small game in.

Despite all of this linguistic infidelity I have faithfully kept up to date on C++, following the draft standard and reading Herb Sutter’s fantastic GotW. But something that’s been coming a long time happened when I read GotW #88: A Candidate For the “Most Important const”.

In this posting he discusses the difference between assigning to a const reference and a non-const reference. Spoiler alert: in the examples he provides it is only legal to assign to a const reference.

I’d actually played around with this “feature” so I was still able to follow along, and then it hit me. I simply don’t care.

I used to think that part of programming was memorizing these syntactic quirks (be sure to put a space between the >’s in a nested template declaration!). As a C++ developer I always kept them in mind but accepted them, surely other languages must have their own. I suppose this is still true, and a handful of others do come to mind.. but what has changed in my way of thinking is that they are a necessary part of a language.

So getting down to what I need to say.. C++, I know when I put you down years ago I said I’d be back - that these other languages were fun but you were the one for me. I just think we’ve grown apart, it’s best we both move along. It’s time I made an honest language out of Python and admitted I’m a Python programmer.

Popularity: 5%

5 comments ↓

#1 Greg M on 01.04.08 at 6:08 am

You can’t be unaware that Python has these kind of quirks in abundance? And without necessarily having the well-considered reasons behind them C++ does? Sure, it’s a little better, but if that’s the reason for your journey, Python is a bizarre choice of destination.

#2 James on 01.04.08 at 1:20 pm

I’ve been using Python regularly for several years and I nothing in the same category comes to mind.

I don’t doubt that C++ has it’s reasons either.. the people who design it are much more talented than myself I’m sure, I think that Python’s emphasis on readability and “There should be one– and preferably only one –obvious way to do it” leads to the cleanliness I appreciate here.

A python quirk that I can think of would be self, but I think that the reasons for this are a lot more established than the reasons for std::vector> (which I know is fixed in the draft spec)

The ability to remove bugs like this I think can be attributed to having a BDFL and using community PEPs vs. a committee. I realize having an ISO standard/etc is useful, but when every compiler implementer has it’s own quirks some of the usefulness is lost.

#3 Ben on 01.05.08 at 12:08 pm

C++ is a complicated language that has funny rules because of the C language compatibility. For many domains it just doesn’t make a lot of sense any more. I really like it for large scale hard real-time systems though. The OO support of the language allows a large team to cooperate, while still writing deterministic code. The C language support allows control code for low level components like motors or sensors to link transparently into the application and service layers - it scales beautifully. That said, if you’re using C++ to write a Linux desktop application, you may be doing the wrong thing. In other words, your ‘primary’ language should be determined by your primary task domain, not your bias to a syntax. IMO

#4 James on 01.05.08 at 7:06 pm

I’d agree Ben, for the type of things you’re talking about C++ or C are almost required, and I’d certainly prefer C++ over raw C for most tasks for the reasons you provide.

I think that most domains where you’re writing anything for an end-user (web, desktop, games even to an extent) give a lot more flexibility in language than embedded/real-time systems.

#5 Dejan Lekic on 01.06.08 at 2:51 pm

James, I am professional C++ developer since 1992, and I switched to programming language called “D” few years ago. I think You should try it. Considering what You wrote above You will definitely like D. :)

Kind regards

Leave a Comment