3 ms·
> The C standard was apparently written in order to allow compilers to introduce subtle security holes into previously-working code, all in the name of a fracti
by lmm 12y ago
> The C standard was apparently written in order to allow compilers to introduce subtle security holes into previously-working code, all in the name of a fraction of a percent of performance increase.
Yes it was. Or at least, that's the constituency C currently has - and understandably C continues to serve it. There needs to be a language for that kind of people, and that language is C.
If you don't want that, stop using C. It's not hard.
- mpweiher 12y agoI've been using C since before there even was a standard. Why should I ditch the language because <deleted> have hijacked the language spec?
- lmm 12y agoBecause they're the ones who the language is valuable to. You have plenty of other options; they don't.
- mpweiher 12y agoFor the sorts of semantics they are looking for, FORTRAN seems to be a good option. Or keep the crazy in C++ land? What are my options if I want a simple, easy to understand language that is close to the execution model of current machines?
- kragen 12y agoYour suggestion is ridiculous. First, it wouldn’t be enough to stop using C; I would also have to stop using software written in C. And C++. Second, there aren’t any reasonable alternatives to C — it’s not the only portable low-level language, but it’s the only popular one, other than C++, which shares the same problems.
- makomk 12y agoNo, it wasn't written for that purpose at all. Many of these undefined behaviours exist in the spec because long ago, there was some exotic architecture where doing that thing caused a hardware exception or behaved strangely. For instance, on some systems that are no longer in use, trying to obtain the pointer in this example would cause an access violation and abort the program because pointer calculations are checked in hardware. It was never intended as an excuse for compiler writers to randomly decide to be dicks.
- kragen 12y agoThere’s that, and then there’s also long-ago exotic architectures where you weren’t processing untrusted data, you really did care about improving your performance by ½%, and it really was worth the massive amount of programmer time needed to debug the resulting problems. There’s a famous apocryphal quote that writing C for the Cray (?) compiler was like “writing to [the programmer’s] ex-wife’s lawyer”. Also, there are still Unisys Clearpath/MCP systems in use.