Low level systems programming with C++

Henry H picture Henry H · Nov 22, 2010 · Viewed 18.9k times · Source

I have been using C++ for a while now and I began to get interested in lower level system programming like drivers and stuff. Even some kind of primitive operating system could be very interesting project!

I have no clue where I could start. Are there any not-too-challenging things I could get started with and are there anything about C++ I should try to avoid like exceptions in performance critical code?

My current OS is Windows 7 if that matters much.

Answer

Hans Passant picture Hans Passant · Nov 22, 2010

Writing Windows device drivers in C++ isn't impossible, there are not many CRT functions that you could use to get you into trouble. The new operator is unusable for example, you don't have to fear a std::bad_alloc. Unless you replace it, that cuts out a rather large swath of standard C++ library classes.

But that's not really the point of a device driver, it is rather important that you make it as small as possible. C++ pays off when you write complex code. You explicitly do not want to write complex code in a device driver. Debugging it is redrum.

Linus really likes C in the kernel. There's a good reason for that.