3 ms·
> You've essentially described C I'd disagree pretty strongly with that. C is more focused on being relatively simple to implement and backwards compatibility
by IAmLiterallyAB 3y ago
> You've essentially described C
I'd disagree pretty strongly with that. C is more focused on being relatively simple to implement and backwards compatibility with the past 50 years. (I read a blog post by a C committee member talking about that recently, wish I could find the link)
Just look at the garbage fire which is the standard library. qsort. strtok. rand.
C++ should (in theory at least) be able to match or surpass C for _any_ performance benchmark, because it simply gives you more tools in your toolbox. For example, C is never going to be able to beat std::sort because it can't monomorphize in the compare function.
I'm not saying C++ is perfect either (looking at you unordered_map and regex). But I am saying people look at C with rose colored glasses.
- trealira 3y agoYeah, I think a degree of complexity is required to achieve being the fastest compiled language. To achieve that, you need stuff like monomorphized templates, actual arrays and slices being distinguished from pointers, well-defined rules on pointers (like Rust's rules about references and mutable references, or strict aliasing in C++), and the freedom to let the compiler reorder structure fields for better alignment and space usage. Runtime polymorphism, like virtual functions in C++, are better as a core language feature rather than something implemented as a struct of function pointers, because that way the compiler can devirtualize some calls. All of these things, I think most C programmers would be against adding to C. And pointer rules are historically controversial; for example, Dennis Ritchie was against adding noalias to C in 1988[1]. [1]: https://www.yodaiken.com/2021/03/19/dennis-ritchie-on-alias-analysis-in-the-c-programming-language-1988/ https://www.yodaiken.com/2021/03/19/dennis-ritchie-on-alias-...
- rewmie 3y ago[dead]