Skip to main content

C++ sucks part two

You like speed? C++ will not get any faster

Because C++ support for multi-threading is lackluster. You've pretty much got to roll your own carefully constructed tools to avoid even the most common mistakes multi-threading can introduce.

"What about C++0x?" I hear you say. Screw that! Sure a lot of the stuff being proposed is a huge improvement. But it's been sitting around since 98. When am I going to see this in a compiler? When can I use it? I'm slowly dying here as processors get more and more cores.

To write a program in C++ today is to write code that will never run faster. Or will probably crash trying.

You like speed? C++ build times will feel like riding the bus

Builds are sooo slow. While trivial programs can build from scratch in seconds. Typical programs can take minutes to build from scratch. Complex programs can take so long to build it's usually farmed off to servers to do a 'nightly build'.

Let's do some math. Assume a program takes 2 minutes to build and maybe due to crappy makefile handling the programmer does 10 clean rebuilds a day (on average). If programmer is paid $40 an hour then he's paid about $300 a year just to run "make".

You like clean code? Good luck because header files suck

Why in C++ do we have to define all our class functions twice? Because if we try and inline them we just make the builds take forever. Every change to a header file can trigger scores of files to rebuild. If you've got a key file like a render it can chain hundreds of files to rebuild just from adding a comment.

So we carefully construct our header files. Fill them with forward declarations and carefully define our class interfaces in the hope we wont ever have to touch the header file again.

But of course interfaces change all the time. We're constantly adjusting things and kicking off painfully slow builds. Or in a rush to get things working including other header files only to chain up even more slow builds in the future.

But frankly we don't even want header files. A computer could figure out the interfaces for a class. But why doesn't the compiler do this for us in C++? It's just a dumb language that wants you to hand hold it through the build process.

Comments

Popular posts from this blog

RestFixture

So most of the tests I'm writing now in Fitnesse are using RestFixture . Being able to do all this black box style testing has helped me get a lot of tests up and running without having to change the existing code base. Now I've taken a step future with my own little fork  so I can use scenarios and build nice BDD style scripts. But first I want to give me own quick guide to using RestFixture Step 1: Installing You can dive straight in by grabbing the latest jar files for RestFixture here  https://github.com/smartrics/RestFixture/downloads If you know what you're doing can get the nodep version to work nicely along side other libraries you may be including in Fitnesse. But I grabbed the 'full' version and unzipped it into a RestFixture folder alongside my FitNesseRoot folder. Step 2: Write your first test I took advantage of the built in Fitnesse api as a basic test and wrote a page called RestFixture with the following contents !define TEST_SYSTEM {slim} !

A brief introduction

And then I'll get into my first rant. I'm some guy who thinks about stuff. Stuff you probably don't care about but I'm going to tell you anyway! Now I don't think I'm going to cure cancer or create world peace but it'd be nice if I could make the world a little better. Stuff I'd like to talk about will focus on: Games I've always been a game player and am fascinated in how one designs a game. Yes it's mostly computer games these days and even then it's mostly consumed by World of Warcraft . Shut-up you in the back! We all have our vices and I'll avoid sniggering at your hentai collection if you leave my level 80 mage alone. Programming Only 2 years ago I was introduced to this weird concept of Test Driven Developmen t and the broader concept of Agile . Programming has been part of my life since I was eight. When I haven't been doing it professionally I've found myself doing it more in my free time. So it's nice that after 20+