3 ms·
So your question is basically "Why are we still using C in 2010?". C is just a mapping to a generic assembly language. The machine will be adding pointers and
by yason 17y ago
So your question is basically "Why are we still using C in 2010?".
C is just a mapping to a generic assembly language. The machine will be adding pointers and integers anyway so this is inevitably reflected in C in one way or another. There are different notations to adding pointers and integers, such as &pointer[index] or casting and adding, but in C you still have to think in terms of pointers and integers.
Why C? The main reason is that it has lots of pragmatic bias for its use. It's simple (unlike C++), it's closeness to assembly makes it a nice candidate for writing low-level layers, and it's supported nearly everywhere (unlike C++). This is hugely important in getting things done even if there were a number of smarter but less pragmatic ways.
- greyman 17y agoC++ can also be simple, if you define beforehand which constructs you will use from the language, and which not. For example, working with std::vector or std:string is usually much simpler than working with char* buff and pointer arithmetic.
- chc 17y agoBut then you're essentially using C+std::string rather than C++. The reason it's simple is that you're ignoring most of the things that distinguish it from C — and even then it's actually quite a bit more complex in ways that you can't get around (e.g. extern "C").