3 ms·
Whenever C gets brought up, people are like, "pointers... memory... dangerous!" That's actually the point. It's even coded into C2x charter ( http://www.open-s
by Keyframe 10y ago
Whenever C gets brought up, people are like, "pointers... memory... dangerous!"
That's actually the point. It's even coded into C2x charter ( http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm ):
The new spirit of C can be summarized in phrases like:
(a) Trust the programmer.
(b) Don't prevent the programmer from doing what needs to be done.
(c) Keep the language small and simple.
(d) Provide only one way to do an operation.
(e) Make it fast, even if it is not guaranteed to be portable.
(f) Make support for safety and security demonstrable.
- loup-vaillant 10y ago(f) Does this mean they'll remove some undefined behaviour? Or at least mandates options to that effect? That would be marvellous.
- wangchow 10y agoI tend to read undefined as don't do it
- syncsynchalt 10y agoIt's not always possible / feasible to avoid undefined operations. Use the modulo operator? Undefined unless you checked for negative first. Add two integers? Undefined unless you check for overflow. Granted those examples get a pass because on modern two-complement architectures everything handles the undefined behavior in an identical way.
- loup-vaillant 10y agoI believe the modulo operator is implementation defined. As should be signed integer overflow, though it isn't. One big problem about "undefined" is, when some platform go bananas over some stuff, the behaviour is standardised as undefined for all platforms, allowing the compilers to go bananas. Which they do, because every bit of undefined helps them perform some micro-optimization they couldn't do before. I long for the day where the standard forces compilers to provide options such as -fwrap or -fno-strict on platforms that can reasonably support it.
- nickpsecurity 10y agoThat's Modula-2. Maybe they just need to change the syntax a bit to look more like C, built an IDE plugin, and reboot the Modula-2-to-C compiler to leverage optimizing compilers. From the reboot one group is doing: http://modula-2.info/m2r10/pmwiki.php/Spec/DesignPrinciples http://modula-2.info/m2r10/pmwiki.php/Spec/DesignPrinciples
- bitwize 10y agoThat's the thing; programmers are NOT TRUSTWORTHY. This is a "humans are fallible" thing, not a "you can't trust stupid programmers" thing. This is why C and Unix are irredeemably flawed designs; they trust the individual programmer/sysadmin to get things right and disaster happens when they don't. In the case of Unix, it can be demolished with a single fat-fingered rm command as root. VMS made a different call: in VMS it is assumed that the sysadmin is tired and hasn't had their coffee. This affects everything from how permissions are assigned to the notorious verbosity -- and extensive help system -- of the VMS shell. Properly configured, VMS was darn-near impregnable; it had also never fallen to the sort of buffer vulnerability common under Unix.
- hash-set 10y agoToo bad the business model of VMS was so bad, eh? UNIX, and more to the point, KILLED VMS on every front. And yes, I have had the displeasure of having to use VMS and code in it and deal with the special snowflake sysadmin people who operate VMS, the most recent one being just two years ago. What a time! What mystifies me is that there are still many companies out there who refuse (stuck?) to migrate off of ancient OpenVMS Alpha hardware--all because the IT people stomp their feet and throw tantrums and won't let it go. Where are the rational tech people? Still advocating these monoliths for job security... VMS had its day, its day is over. Learn. New. Skills. I enjoyed using VMS in college years ago. I am now biased because I have never been mistreated as a professional developer so badly than while dealing with that VMS admin! The man was so toxic that the company should have fired him many times over but refused because he was the "only" one who could kinda sorta run their database (note: they had to restart the application daily to keep it running and the boxes had all kinds of memory issues and they were buying used hardware off of eBay to keep it running--this is a major healthcare company mind you, thousands of customers whose lives are at stake). Time marches on, skillsets have to be upgraded, which is apparently too much for some people to accept. Dumb companies, dumb sysadmins.
- dTal 10y agoSeems to me (b) and (d) are mutually exclusive, as are (a) and (f).