What's C's biggest mistake?
Kevin Bealer
kevinbealer at gmail.com
Thu Dec 31 16:39:43 PST 2009
BCS Wrote:
> Hello Walter,
>
> > BCS wrote:
> >
> >> I guess my point is that aside from VERY resource limited systems,
> >> almost no one will have C as their first choice. Even with those
> >> limited systems I'd bet that most people would rather be working in
> >> something else if they could. That said, there are many places where
> >> it ends up being the lingua franca.
> >>
> > I still think you're underestimating C's audience. Consider the Linux
> > effort - they can choose any implementation language they want, and
> > they choose C. They aren't forced into C.
> >
>
> Yes, C has a wide audience (any one who says differently is selling something).
> But I still thing that their are very few cases where C will be chosen for
> reasons other than it's purely technical merits. If C++/Java/C#/python/whatever
> would have done just as good a job in Linux as C, I'd almost bet that Linux
> wouldn't have been written in C. My point isn't that C is never the right
> choice (as that is clearly false) but that when C is chosen, it's (almost)
> always for technical reasons rather than aesthetic ones (where it is merely
> good enough).
I would say these are the technical merits of C that get it chosen these days:
1. The new code they're writing will be part of a large body of existing C code which they don't have time, permission, or inclination to convert to C++.
2. They need to be aware of every tiny low level detail anyway, so having the language do too many things "for you" is not the desired approach (security, O/S and embedded work).
3. C has a real ABI on almost every platform; therefore, C is chosen for most inter-language work such as writing python modules.
But some people really *are* choosing C for aesthetics. Linus Torvalds, bless his little world dominating heart, chose C for a normal app (git), and he cited that the existence of operator overloading in C++ is bad because it hides information -- e.g. in the general case you "never know what an expression is actually doing."
I think this can be seen as mainly an aesthetic choice. Avoiding a language because it *supports* information hiding (which is what I think operator overloading is) is not really an 'economic' tradeoff, since you could choose not to hide information by not using those features. He'd just rather not be in the vicinity of language features that make those kinds of choices because they seem wrong to him (and because he wants to keep C++ies out of his code I think.)
Some people want their language to have a "WYSIWYG" relationship with the generated assembler code (if I'm right, it does seem consistent with him being an OS developer).
I also know some scientists and mathematicians who use C rather than C++. I think the reason is that by using a simpler language they can know everything about the language. I think the sooner they can 'get the computer science stuff out of the way', the sooner they can focus on what they see as the domain issues. (I think once the program gets big enough, the CompSci aspects reassert themself and scalability and maintainability issues begin to bite you in the rear.)
Kevin
More information about the Digitalmars-d
mailing list