3 ms·
That is the philosophy of most modern languages. It isn't the philosophy of C. If C took that approach, it would lose many of its unique advantages. Whether p
by MaxBarraclough 8y ago
That is the philosophy of most modern languages. It isn't the philosophy of C.
If C took that approach, it would lose many of its unique advantages.
Whether performance matters, depends wholly on what you're doing. There can be no one-size-fits-all programming language.
- raverbashing 8y ago> If C took that approach, it would lose many of its unique advantages. Such as? > Whether performance matters, depends wholly on what you're doing. There can be no one-size-fits-all programming language. Correct. But I think the performance side is overrated because C does not have the needed expressiveness to use most modern performance enhancements (like SIMD, auto vectorizing requires a lot of work and checking of conditions, and is not very efficient) and what were important optimizations 40 yrs ago today are reckless (like no boundary checks) (This discussion doesn't apply to embedded systems for the most part, those today a lot of them are faster than 15y.o. PCs)
- MaxBarraclough 8y ago> Such as? Extremely high performance, compact binaries, and its ability to be used both for cross-platform functionality, and for low-level and platform-specific functionality. All the reasons C took over the world (every major operating-system and game-engine, for starters), rather than its competitors. Kernel developers and game-engine developers care about performance. Embedded developers care about binary size. It doesn't do to pretend that C's advantages there don't really matter. C isn't a 'big government' language like Java. It isn't meant to be. It's meant to be more of a very-high-level assembly language. Programming languages are a matter of tradeoffs, not of the 'one true path'. If you want a language with good safety assurances, look elsewhere. > C does not have the needed expressiveness to use most modern performance enhancements (like SIMD, auto vectorizing requires a lot of work and checking of conditions, and is not very efficient) Auto-vectorisation is a tough nut to crack, sure. That's not specific to C though. Even frameworks like OpenCL are based on C. > what were important optimizations 40 yrs ago today are reckless (like no boundary checks) C has a pretty terrible track-record on security, yes. Precisely because it's not a safe language. I believe Clang now has a flag to add runtime boundary-checks. For many applications, I agree with you that it would be worth the performance penalty to enable that runtime check in all builds.
- pjmlp 8y ago> Extremely high performance, compact binaries, and its ability to be used both for cross-platform functionality, and for low-level and platform-specific functionality. All the reasons C took over the world (every major operating-system and game-engine, for starters), rather than its competitors. After 30 years of throwing money at it.
- swebs 8y agoNah, it's had those advantages since year 1. Like the the other guy said, it's pretty much high level, portable assembly. It wasn't until later that modern languages introduced bounds checking, virtual machines, garbage collectors, and other things that improve safety but have performance and bloat tradeoffs.
- pjmlp 8y agoMe and others that had our 16 bit codebases full with inline Assembly beg to differ. C benefited from the domino effect of UNIX's adoption, that is all. Had AT&T been allowed to sell UNIX at the same price points as VMS, OS/360, Star among many others, and C would have been a footnote on the history of system programming languages, like many others.
- MaxBarraclough 8y agoBut C code is faster than any other major language, and its low-level facilities are better. > C would have been a footnote on the history of system programming languages, like many others Which programming language would Vulkan be using if we didn't have C? Presumably a language much like C, no?
- pjmlp 8y agoC became faster thanks to 30 years of compiler research improving optimization algorithms while taking advantage of UB. Something else naturally, with stronger memory guarantees and memory unsafe constructs clearly expressed on the type system, like Ada/SPARK, PL/8, PL/S, BLISS or whatever else might have wiped UNIX if it had been closed source sold at the same price level as OS/360, VMS among others.