45 ms·
The Development of the C Language (1993)
- boughtbars 3y ago[dead]
- honey212 3y ago[dead]
- zabzonk 3y agoi had read this before, and it has been posted here multiple times, but somehow i had missed: > Thus the core C language escaped nearly unscathed from the standardization process, and the Standard emerged more as a better, careful codification than a new invention. which made me grin.
- kps 3y agoIn 1993 the unintended consequences of X3J11 “undefined behavior” had not yet emerged, nor had the reality that future Standard committees would double down rather than fix it. If anyone had realized what UB would turn out to mean, it would not have been invented that way. Dennis Ritchie's 1988 comments on the `noalias` proposal match exactly: “the committee is planting timebombs that are sure to explode in people's faces”; “a license for the compiler to undertake aggressive optimizations that are completely legal by the committee's rules, but make hash of apparently safe programs”, and consequently: “[It] must go. This is non-negotiable. [...] The concept is wrong from start to finish. It negates every brave promise X3J11 ever made about codifying existing practices, preserving the existing body of code, and keeping (dare I say it?) ‘the spirit of C.’”
- marcosdumay 3y agoI don't think it was even possible to predict what "undefined behavior" would turn out to mean, because the modern interpretation does clearly not come from the standards text. The standard describes the old interpretation of "if you do that, you get the consequences". The fact that somebody came up with a reinterpretation that bring a completely unreasonable meaning that just happens to be compatible with the text is all up to the people reinterpreting it. Nobody preemptively disavows unreasonable interpretations when writing something.
- ketzu 3y agoThis might miss a (1993) tag. Interestingly, some might print the same title about JavaScript.
- revskill 3y agoSo the conclusion is, Rust will never be a success because everyone loves it ?
- zabzonk 3y agoeveryone?
- Patrickmi 3y agoWhen I get to achieve my target 3 times faster using Go why should I waste my time following “functional ways” just to use to write project A
- mdp2021 3y agoIt will depend on your goal. Do they produce the same output? Or just comparable results? Edit: oh, look at the chances - the ("the [only]" - 2nd to 1st) neighbouring submission is "How small is the smallest .NET Hello World binary". Suggests non overlappable outputs.
- junon 3y agoRust is not "functional ways", though, and Go is certainly not devoid of annoyances (subjectively). Really wish people would stop having language wars and realize that languages are tools for a job. C is like a flathead screwdriver, C++ is like a philips, Rust like a torx and Go like a hex. You can probably use a flatheat or even a philips for the torx or hex screws but you probably shouldn't, because they're not the right tool for the job. I love Rust. I use Rust often. I choose it over C or C++ these days for a number of reasons. But I'm not going to write some throwaway little one-off scripts in Rust. I'd probably choose Python if I need to crunch some data, or Node (javascript) to do some quick I/O related tasks. I'll use a makefile when windows compatibility and graph evaluation speed aren't important, and a shell script when compatibility and graphs aren't important at all. And so on. The sooner people begin to realize this, collectively, we can stop having these silly "X language is better than Y" discussions. C has its place. It's simple (quirky, but simple), doesn't take on a philosophy, and has a very, very wide set of compatible toolchains. That is the reality. Perhaps C-like's will take off and replace it (e.g. Drew Devault's Hare[0]) to get us away from most of the quirks, but that probably isn't happening any time soon. In the same way that "putting ChatGPT in front of a computer-enabled machine gun is irresponsible", so is using unsafe languages in cases where you absolutely cannot afford a security risk without some sort of safeguards, verifiers, etc. and just good ol' fashioned "good engineering". And even in "safe" languages this is often hard to achieve, so it often comes down to the engineers anyway - not the language. I feel like we have beaten the "C sucks" horse to death so many times that we could extract oil from it at this point. What is the goal with such discussions in 2023? [0] https://harelang.org https://harelang.org
- w4rh4wk5 3y agoI wonder how much the pile of undefined behavior contributed to C's success. I can imagine that vendors picked C over alternatives due to C giving them more freedom with their implementation.
- badsectoracula 3y agoIsn't the other way around? Vendors already had picked C and they wanted to claim compliance to the then brand new C89 standard so anything they didn't want to give up on was deemed "implementation-defined behavior" and anything they couldn't give up on[0] was deemed "undefined behavior". [0] because their machines worked very differently from the others' machines
- Thiez 3y agoThat doesn't really explain how stuff like not ending a source file with a newline is UB.
- jillesvangurp 3y agoI'd say that's more of an annoyance than a feature. The reason vendors use C is because it is there, comes with compilers, ides, tools, operating systems, etc. that will all work out of the box as soon as they get the compiler going on a new hardware platform. Just a critical mass of stuff that they need that conveniently is right there. And when you need to add just a few tiny things, you are going to stick with what's right in front of you instead of rebuilding all of that from scratch.
- ajb 3y agoWhat you are thinking about there is perhaps implementation defined behavior, which is distinct from undefined behavior; and the sequence was the other way round - hardware with different behaviors already existed, and not specifying them in the language allowed C to succeed because it wasn't tied to a particular machine. The answer is different for different kinds of undefined behavior, but spatial memory safety violations are basically always possible in a language you can write an OS in, since you need to convert from hardware buffers to higher level types. temporal memory safety wasn't possible to enforce at the time on a low level language, it's taken decades for it to be implemented in a mainstream non-garbage-collected language. Integer overerflow is still not caught by default even in rust for efficiency reasons (it would take all the processor vendors to implement an efficient way of catching it)
- babarock 3y agoPeople who still write C, honest question: Why? C is full of quirks. From cryptic "undefined behaviors" to a type system that isn't really a type system (more like "size hints for the compiler"), the language doesn't feel easy to use/debug. Add to this CPP macros, a universally recognized bad idea, a clunky import system, and lack of a single reference implementation of the compiler/libC, and you have a language that is harsh to defend. Also, documentation is all over the place. If a function isn't described in `man`, I have no idea where else to actually look for it. I used to think "C presents the most honest representation of the low-level mechanisms of the computer", but... even this is shaky. I've been programming for almost 15 years now, and I don't think I've ever seen a computer where memory is actually a continuous array of bits sorted by memory address. The C representation of memory (and all the pointer arithmetic) is not a real representation of your hardware, and this too is an abstraction. So, setting aside the need to maintain 30+ year old code, what would be modern reasons to start a new project in C?
- zabzonk 3y ago> I don't think I've ever seen a computer where memory is actually a continuous array of bits sorted by memory address well, that is not the C memory model. C does not allow you to access bits in memory directly. maybe you meant bytes? or words? if so, many cpus have exactly that architecture.
- heywhatupboys 3y ago> C does not allow you to access bits in memory directly. of course it does what are you talking about?
- rwxer 3y agoOriginal title: The Development of the C Language Editorialized title: “C is quirky, flawed, and an enormous success” – Dennis Ritchie HN Guideline: > [...] please use the original title, unless it is misleading or linkbait; don't editorialize.
- deleted 3y ago[deleted]
- tester756 3y agoI just wish C had better compilers Errors produced by current mainstream compilers are terrible. "Unresolved symbol" being the best they can do is some joke
- jjgreen 3y agoUh? gcc (11) produces, eg /usr/bin/ld: main.o: in function `main': <path>/cptutils/src/xycpt/main.c:148: undefined reference to `xycpt' You get the file, the line, the name of the missing symbol ...
- tester756 3y agoEverything looks fine if you use hello world examples Yet when reality kicks in, then you can spend 15mins trying to figure what the hells is going on
- jjgreen 3y agoNot a hello world example, I renamed a function in a program which is part of a 13K LoC project to get that error message.
- zabzonk 3y agothat's the linker, not the c compiler
- tester756 3y agoIs this important? I treat compiler as *full* toolchain I run compilation and expect sane error messages - saying that "oh, it's because of linker yada yada" doesn't solve my problems nor is valid excuse Other language (compilers) do better.
- zabzonk 3y ago> I treat compiler as full toolchain well, you may do that, but it doesn't make it so. the linker has much less information to go on than the compiler - basically (depending on how you compiled) machine code. actually, the GNU linker does quite a good job, given what it has to work with. > Other language (compilers) do better. a language is not a compiler
- pjmlp 3y ago"Although the first edition of K&R described most of the rules that brought C's type structure to its present form, many programs written in the older, more relaxed style persisted, and so did compilers that tolerated it. To encourage people to pay more attention to the official language rules, to detect legal but suspicious constructions, and to help find interface mismatches undetectable with simple mechanisms for separate compilation, Steve Johnson adapted his pcc compiler to produce lint [Johnson 79b], which scanned a set of files and remarked on dubious constructions." Since 1979! And people keep complaining about being forced to use static analysis in C, on build pipelines. "I know better", yeah, sure.
- zabzonk 3y agothey should simply use c++, like k&r did to compile their example code in their 2nd ed - see preface to book if you don't believe. i will never understand why C programmers get so upset about C++. of course, the latest revisions of C introduce some new features not in C++, but nothing really major. if you want good type checking, compile your C code with C++, and fix all the type errors you will get.
- pjmlp 3y agoPetzold did the same on his highly acclaimed book for Windows 3.x book, also with a note on the preface regarding type safety. Likewise, Microsoft introduced windowsx.h header file, to improve type safety while using C for Windows 3.x applications.
- zabzonk 3y ago> Petzold did the same on his highly acclaimed book takes me back. i thought it was crap. i used to work at The Instruction Set (one of UK's biggest tech training companies at the time) and everyone hated the Windows/C course based on Petzold. my boss came up to me (somehow I was the windows guy in a unix company) and said "we need a new windows course" and me said "OK, i need a framemaker license and to work at home for a week" - worked out great. this was early 90s, i suppose?
- 9659 3y agoThese men were/are giants in the field. But look at how simple the language was in the beginning. A handful of concepts, strung together. Incremental changes; not all were deemed best in hindsight. You can fit what is going on in 16K in your head.
- keepamovin 3y agoI want to read this. I'm also interested in the story of how SHA-0 was developed internally in the NSA if anyone has any idea. I'm a little surprised at folks incredulity that C is used "nowadays". To me, there will always be a place for C. If you look at: - the bulk of the internet traffic - the bulk of the base OS systems and libraries it is running on I'd say 99.9% of that is written in C. Hence my surprise. I know Linus now embraces Rust in the Kernel or whatever and I'm not disparaging that, just seems obvious that C, old as it may be, is still highly relevant. C is a graybeard. Give it a break, right? :)
- tacker2000 3y agoDont forget embedded/iot/automotive etc… The use of C will even increase as every square meter of the globe is going to be littered with small connected devices.
- keepamovin 3y agoExactly! Tho I don't know much about that stuff so I thought, maybe there's a possibility they all be doin trend thangs like bein Rustaceans etc or Gophers even (if that's a thang still?)
- gjvc 3y ago""As we said in the preface to the first edition, C "wears well as one’s experience with it grows." With a decade more experience, we still feel that way."" -- Brian Kernighan
- Timpy 3y agoMy career is in full stack web development but I program in C in my master's degree coursework and as a hobby. Every time I have to peel back a decade's worth of CSS to move a button on a webapp I daydream of moving to a career in C. Is the grass actually greener on the other side?
- dahfizz 3y agoI program in C (HFT) and I love it
- csdreamer7 3y agoThat is interesting. Most HFT I hear uses C++. Why C?
- dahfizz 3y agoThe people who were there at the start were more proficient at C
- bhasi 3y agoI'm an embedded Linux engineer and I love C and Linux in particular. However, I'm considering dipping my toes in non-embedded stuff for a while, particularly full-stack development and wondering if the grass is greener on the other side from me, haha!
- i_am_a_peasant 3y agoI did that... Then committed myself back to embedded a couple of years later.
- synergy20 3y agowhy is that? I am an embedded linux guy but I'm learning full stack all the time, plan to be able to do both, though, it's really hard. embedded linux pay is fine but not great, not sure how it compares to full stack jobs. full stack at least is more remote friendly as it does not need deal with hardware hands on which is not remote friendly, and, things made by full stack is potentially more scalable.
- dang 3y agoRelated: The Development of the C Language (2003) - https://news.ycombinator.com/item?id=19338525 https://news.ycombinator.com/item?id=19338525 - March 2019 (10 comments) The Development of the C Language - https://news.ycombinator.com/item?id=15134903 https://news.ycombinator.com/item?id=15134903 - Aug 2017 (22 comments) The Development of the C Language* by Dennis Ritchie (1996) - https://news.ycombinator.com/item?id=11973627 https://news.ycombinator.com/item?id=11973627 - June 2016 (1 comment) The Development of the C Language (1993) - https://news.ycombinator.com/item?id=10749358 https://news.ycombinator.com/item?id=10749358 - Dec 2015 (28 comments) The Development of the C Language - https://news.ycombinator.com/item?id=3439843 https://news.ycombinator.com/item?id=3439843 - Jan 2012 (1 comment) The Development of the C Language - https://news.ycombinator.com/item?id=2258287 https://news.ycombinator.com/item?id=2258287 - Feb 2011 (7 comments) The Development of the C Language - https://news.ycombinator.com/item?id=726519 https://news.ycombinator.com/item?id=726519 - July 2009 (1 comment) The Development of the C Language (Dennis Ritchie) - https://news.ycombinator.com/item?id=365080 https://news.ycombinator.com/item?id=365080 - Nov 2008 (1 comment)
- ntfAX 3y ago[dead]
- nathants 3y agoeveryone should learn c/c++. you need it when exploring the performance ceiling of a workload. without an understanding of performance ceiling, you can’t design a system well. if you want to approach that ceiling[1], you need to implement c/c++. if not, it’s better to have chosen not than been forced not. between ccls, clangd, and clion, tooling is fantastic now. it’s a great time to start. 1. https://github.com/nathants/bsv https://github.com/nathants/bsv
- robinunkempt 3y ago[dead]
- robinunkempt 3y ago[dead]
- northwoozy 3y ago[dead]
- cat81 3y ago[dead]
- wigmoccasins 3y ago[dead]
- wigmoccasins 3y ago[dead]
- hoeogre 3y ago[dead]
- hoeogre 3y ago[dead]
- glovesregal 3y ago[dead]
- glovesregal 3y ago[dead]
- cretin34 3y ago[dead]
- cretin34 3y ago[dead]
- unwritten32 3y ago[dead]
- unwritten32 3y ago[dead]
- looselink 3y ago[dead]
- looselink 3y ago[dead]
- churchboing 3y ago[dead]
- churchboing 3y ago[dead]
- canoeingstray 3y ago[dead]
- canoeingstray 3y ago[dead]
- thornynetherite 3y ago[dead]
- thornynetherite 3y ago[dead]
- outfieldshare 3y ago[dead]
- outfieldshare 3y ago[dead]
- calculate23 3y ago[dead]
- calculate23 3y ago[dead]
- tuxedoguard 3y ago[dead]
- tuxedoguard 3y ago[dead]
- ferrethole 3y ago[dead]
- ferrethole 3y ago[dead]
- fiftydelayed 3y ago[dead]
- fiftydelayed 3y ago[dead]
- kingfupoke 3y ago[dead]
- kingfupoke 3y ago[dead]
- Pic45 3y ago[dead]
- Pic45 3y ago[dead]
- onerous21 3y ago[dead]
- onerous21 3y ago[dead]
- gleefulstrike 3y ago[dead]
- gleefulstrike 3y ago[dead]
- pinkllama 3y ago[dead]
- pinkllama 3y ago[dead]
- rnafoot 3y ago[dead]
- rnafoot 3y ago[dead]
- scheme43 3y ago[dead]
- scheme43 3y ago[dead]
- volleyball45 3y ago[dead]
- volleyball45 3y ago[dead]
- eve43 3y ago[dead]
- eve43 3y ago[dead]
- royallepe 3y ago[dead]
- royallepe 3y ago[dead]
- deercroissant 3y ago[dead]
- deercroissant 3y ago[dead]
- northwoozy 3y ago[dead]
- scorched67 3y ago[dead]
- scorched67 3y ago[dead]
- forestay56 3y ago[dead]
- forestay56 3y ago[dead]
- sailorpetty 3y ago[dead]
- sailorpetty 3y ago[dead]
- squeamish3 3y ago[dead]
- squeamish3 3y ago[dead]
- referavoid 3y ago[dead]
- kidneycurved 3y ago[dead]
- kidneycurved 3y ago[dead]
- search43 3y ago[dead]
- referavoid 3y ago[dead]
- vaultertight 3y ago[dead]
- vaultertight 3y ago[dead]
- eBay54 3y ago[dead]
- eBay54 3y ago[dead]
- crease34 3y ago[dead]
- crease34 3y ago[dead]
- insectjack 3y ago[dead]
- insectjack 3y ago[dead]
- boughtbars 3y ago[dead]
- dizzycaviar 3y ago[dead]
- dizzycaviar 3y ago[dead]
- incident5 3y ago[dead]
- incident5 3y ago[dead]
- transmobility 3y ago[dead]
- transmobility 3y ago[dead]
- stow34 3y ago[dead]
- stow34 3y ago[dead]
- lovable4 3y ago[dead]
- lovable4 3y ago[dead]
- search43 3y ago[dead]
- auditorjavelin 3y ago[dead]
- auditorjavelin 3y ago[dead]
- solarreport 3y ago[dead]
- solarreport 3y ago[dead]
- woeful32 3y ago[dead]
- woeful32 3y ago[dead]
- movement3 3y ago[dead]
- movement3 3y ago[dead]
- plumsfeliz 3y ago[dead]
- plumsfeliz 3y ago[dead]
- casanova1111 3y ago[dead]
- casanova1111 3y ago[dead]
- ducks13213 3y ago[dead]
- ducks13213 3y ago[dead]
- buddha345436 3y ago[dead]
- buddha345436 3y ago[dead]
- sentenc123 3y ago[dead]
- sentenc123 3y ago[dead]
- whos564 3y ago[dead]
- whos564 3y ago[dead]
- pen98271 3y ago[dead]
- pen98271 3y ago[dead]
- hen987433 3y ago[dead]
- hen987433 3y ago[dead]
- ball823 3y ago[dead]
- ball823 3y ago[dead]
- honey212 3y ago[dead]
- oldmen983 3y ago[dead]
- oldmen983 3y ago[dead]
- phoneworld23 3y ago[dead]
- phoneworld23 3y ago[dead]
- hexa872 3y ago[dead]
- hexa872 3y ago[dead]
- theme8972 3y ago[dead]
- theme8972 3y ago[dead]
- provide9218 3y ago[dead]
- provide9218 3y ago[dead]
- anna022 3y ago[dead]
- anna022 3y ago[dead]
- henry871 3y ago[dead]
- henry871 3y ago[dead]
- stive923 3y ago[dead]
- stive923 3y ago[dead]
- clark9082 3y ago[dead]
- mark09237 3y ago[dead]
- mark09237 3y ago[dead]
- clark9082 3y ago[dead]
- Alexa871 3y ago[dead]
- Alexa871 3y ago[dead]
- crazy8923 3y ago[dead]
- crazy8923 3y ago[dead]
- bad89 3y ago[dead]
- bad89 3y ago[dead]
- crush0923 3y ago[dead]
- boy8768 3y ago[dead]
- boy8768 3y ago[dead]
- crush0923 3y ago[dead]
- micy87 3y ago[dead]
- micy87 3y ago[dead]
- helloguy77 3y ago[dead]
- helloguy77 3y ago[dead]
- friends34 3y ago[dead]
- friends34 3y ago[dead]
- world9871 3y ago[dead]
- world9871 3y ago[dead]
- earth9802 3y ago[dead]
- earth9802 3y ago[dead]
- smith9081 3y ago[dead]
- smith9081 3y ago[dead]
- bereb092 3y ago[dead]
- bereb092 3y ago[dead]
- kerim023 3y ago[dead]
- kerim023 3y ago[dead]
- maltem02 3y ago[dead]
- maltem02 3y ago[dead]
- data871 3y ago[dead]
- annael32 3y ago[dead]
- annael32 3y ago[dead]
- chemist823 3y ago[dead]
- data871 3y ago[dead]
- computerboy891 3y ago[dead]
- computerboy891 3y ago[dead]
- appleboy9081 3y ago[dead]
- appleboy9081 3y ago[dead]
- mango912 3y ago[dead]
- mango912 3y ago[dead]
- tiger923 3y ago[dead]
- tiger923 3y ago[dead]
- doggy89021 3y ago[dead]
- doggy89021 3y ago[dead]
- chemist823 3y ago[dead]
- cat81 3y ago[dead]
- lazyboy892 3y ago[dead]
- lazyboy892 3y ago[dead]
- van8902 3y ago[dead]
- van8902 3y ago[dead]
- robert8923 3y ago[dead]
- robert8923 3y ago[dead]
- practice8912 3y ago[dead]
- practice8912 3y ago[dead]
- jullie23 3y ago[dead]
- jullie23 3y ago[dead]
- anen2031 3y ago[dead]
- anen2031 3y ago[dead]
- tom901 3y ago[dead]
- tom901 3y ago[dead]
- thomas9012 3y ago[dead]
- thomas9012 3y ago[dead]
- up2isomorphism 3y agoWhen the inventor of a language can calmly tell you it is quirky, flawed, it immediately shows how enormously successful it is.