3 ms·
Because every class has overriden operators right? You are basically trying to compare bad code in C++ with great code C. Of course the C wins then.
by Scea91 10y ago
Because every class has overriden operators right? You are basically trying to compare bad code in C++ with great code C. Of course the C wins then.
- taneq 10y agoNo, of course not. But if any overridden operators do exist in scope then you need to know about them in order to correctly interpret an expression. Or are you saying that overriding operators is bad practice in general and should never be used? C has fewer "magic" features than C++, and so it's more often clear just by looking at some code what it does. I like C++, but only because I'm happy to only use the subset of the language which suits me, and I tend to avoid features which increase the cognitive load of reading my code.
- pjmlp 10y agoBesides being unsafe, C is one of the few mainstream languages that doesn't have any form of overloading or non-alphanumeric identifiers. I never understood why it is so had to look at a + b and see it as a.+(b). I also need to look at the documentation or source code to see if sum(a,b) does what I think it does. Python, Ruby, Smalltalk, Ada, Lisp, Scheme, C#, C++, Swift, Rust, D, Scala, Clojure, Kotlin, JavaScript(ES7), ML .... developers seem to be able to cope with it, just C, Go and Java devs not.