The first programming language I ever learned was C++ and I must say back in the day it was simple and elegant. Now its complex and elaborate - maybe because back in the day I used C++ as perhaps a C with classes - maybe that's what it was. I look at the implementation of lambdas in C++ and it makes me want to throw an enranged wobbely(though they are cool but look terrible).
C, on the other hand is what I've routinely enjoyed to program in because its like the old C++ that I knew – simple and elegant. I think one of the reasons why C came to me so easily is because there is so much you can do in C when you're in Linux that C++ sorta goes by the way-side a bit. Obviously not so in Windows, where C has very much become a back-seat passenger.
That being said both have their flaws.
Most of my recent career was been windows-based which is strange personally, having been so very much a Linux person(hence perhaps my affinity with C), and I've found the utility of C/C++ lacking in my day job. The last time I used it was when I worked for Citrix. Every oppurtunity since then has been my own personal projects...
This is primarily because C doesn't have these things by default. Thats bad and good. It good in as much as its something for you to do and bad in that its something for you to do. The language is simple, and it doesn't hurt your eyes as much as C++ does. C++ Looks terribly confusing at times, especially when you start overloading operators, start using generics, templates (though all quite useful) and using multiple inheritance.
I also incorporated that particular library in a broker service i wrote to study the distributed nature of interconnected components in a network (the broker architectural design pattern). I enjoyed that, despite it being a time of naivety( in terms of good practice).
The thing is, C doesn't have that stuff, and it doesn't have arguably the best part of C++ which is classes(and perhaps its stricter type rules). Some people would just forget C and go with C++ but I can't seem to make step. They are very much two separate langauges - although quite similar.
I look back at those projects with a bit of annoyance really - I wrote so many bugs and shot myself in the foot on more than one occasion and i never actually use that stuff anymore. I've basically shelved it, particularly my broker which I *think* I had big ambitions for(and perhaps here lies the problem). I really would like to give it another go and improve it...
So you(well maybe me) sit in this middle-ground of having to remember when and how to use either C or C++ every time we think we need to use it. So if its creating a really fast algorithm, I'd be more inclined to write it in C but equally I could write it in C++. If I wanted to design a system of components that connect together – in most cases I'd use classes in C++. If I wanted to interface with Windows DirectX I'd use C++. If I'd want to write Linux kernel code, it would be in C (btw I'd always use if C# if could but this ain't no discussion bout no C#!)
The main two competing ideas I have is this:
- Linux Kernel is written in C
- Game programming is really mostly written in C++
- Embedded programming seems to be pretty much the real of both.
Why not keep at both, well because you can get confused because they are so similar but they are two different languages. I'm at odds with the idea that if I need to write a device driver, I should just re-familiarize myself with C and if I'm writing a piece of 3D simulation, I should reside myself to a weekend of C++ re-familiarization.
Problem is...well I don't know. Maybe there is no problem? Maybe I should stop worrying about trying to be able to instantaneously be able to switch from one to the other (or in fact any programming language) and reason that perhaps moderation dictates a more case-by-case approach: When you get to Rome, copy the hell out of whatever the Romans are doing, even if they aren't programming in C. Same like when you get to Spain...or Austria or...
I guess, at the end of the day, you can't have everything can you? No one thing is the best, it always just depends. And perhaps thats OK, perhaps thats even *necessary. Perhaps you're just your own worst enemy.
So what all of this has convinced me is that I'd better start writing a new C library which is better, I should also write my C++ Direct X code and stop considering using OpenGL in C and finally that I should stop thinking so much about this stuff!
*still – I like most of C more than I do some parts of C++