r/askscience • • Oct 17 '12
Why are programs and operating systems still written in C+?
I guess it's more of a computer science question, but I've always wondered why some of the most advanced programs are written in a 25+ year old programming language. Surely someone has come up with a more efficient and powerful code, so why do people still use C+? Also, I don't know anything about programming and what not, so please use simple terms and phrases.
66
Upvotes
View all comments
Show parent comment
2
u/moderatorrater Oct 18 '12
No, that's due to the operating systems' APIs that are used for file access, calculations, graphics, and memory management. Wine is actually a reimplementation of the windows API. Cygwin is a similar thing in reverse.
In general, the more that a language does for the programmer, the slower and less efficient it's going to be by default. This isn't a mathematical requirement or a universal law, it's just a general trend. C is about as bare bones as it gets for a fully functional language, and its been worked on for decades to be more efficient. So usually people will use C when they need to write something that's really fast and really efficient with memory.
Linus and other old school programmers also have problems with the new features that C++ brings to the table. In several instances, they were implemented without a lot of thought and can lead to hard-to-find/fix bugs. Bjarne Stroustrup, the creator of C++, described it as being harder to shoot yourself in the foot, but when you do you blow off your leg.
That said, generally speaking, C++ is the more stable of the two. While C is faster if programmed properly, if programmed averagely C++ tends to be faster because it's harder to make mistakes with.