4 ms·
Nobody? What these examples demonstrate is not that C is "hard", but that it's powerful.
by qdpb 13y ago
Nobody?
What these examples demonstrate is not that C is "hard", but that it's powerful.
- pjmlp 13y agoThere isn't a single feature in C that isn't present in more safer languages like Modula-2 or Turbo Pascal. They are as powerful, or even more, than C. Just because C won the battle with those languages, it does not mean we need to live with its design issues ad eternum.
- CoryG89 13y agoHow are you going to go about fixing C? And what design issues? It's pretty bare bones on top of the assembly. What should change?
- GregBuchholz 13y ago* Eliminate sources of undefined behavior * Remove implicit type casting * Have a way to check the hardware overflow flag from the language * Saner syntax for declaring variables (i.e. function pointers) * get rid of null-terminated strings * a module system instead of the preprocessor
- pjmlp 13y agoAdditionally: - Proper arrays with bound checking, which can locally be turned off, if required for performance reasons - Explicit operation for converting arrays into pointers
- RodgerTheGreat 13y agoAlso: - remove crufty alternate syntaxes such as trigraphs and K&R-style definitions - a multiple-pass compiler which removes the need for explicit prototypes/header files
- pornel 13y ago• Modules are on the way: http://clang.llvm.org/docs/Modules.html http://clang.llvm.org/docs/Modules.html • Check for overflow would be awesome indeed. • Undefined behavior avoids massive performance penalties on hardware that wouldn't match the defined behavior, so it's a feature and unlikely to go away (compilers may warn you though).
- pjmlp 13y ago> Modules are on the way: http://clang.llvm.org/docs/Modules.html http://clang.llvm.org/docs/Modules.html Yeah, with luck they will be part of C++17, you just need to wait 4 years for them to be defined and then around 5 more for all major compilers, across all OS to support them. They are not even being discussed for the next C standard, and thus similarly to C blocks, it will remain a clang language extension.
- nwmcsween 13y ago1. Undefined behavior is because not all hardware is the same 2. Pedantic but it's nul terminated, null is something either the same or completely different depending on the implementation. Also what would you recommend for non null strings? passing a struct around of *s and size_t len, _that_ is a horrid idea.