9 ms·
Another day for the HN crowd to express their distaste for C :)
by aleksei 10y ago
Another day for the HN crowd to express their distaste for C :)
- coldcode 10y agoIn a PDF no less. I for one do not miss C (or Objective-C for a long time) at all. I built my first commercial app in C starting in the mid 1985 (Mac). That's how much of an antique this language is.
- pawadu 10y agoAnd yet, the OS and the browser you used to type this comment was written in C or a C-derivative like C++.
- pjmlp 10y agoHistorical accident. It could have been written in any other language that compiled to native code, if we had more options available.
- pawadu 10y agoWell, there are two types of people in this world 1. the type that do something 2. the type that claim they could do it better than the first group (this is by no means limited to programming, it is for example pretty common in politics) So please show me an OS written in Go or Rust or Ruby or Python or Java that people can actually use for day-to-day tasks.
- pjmlp 10y agoIf you pay me my monthly salary to prove you wrong, I will happily do it, should we discuss a work contract?
- pcwalton 10y agoI've been working full time for years on a browser written in Rust. Which category am I in? Yes, C++ is very entrenched. That is a problem. We should be fixing that.
- y_u_no_rust 10y agoI'm still waiting for my mozilla javascript phone bro Rust is a neat a project and all but it's still slowly moving out of neat toy territory
- loup-vaillant 10y agoThere is such a thing as path dependence. C got ubiquitous because of reasons (UNIX?), and now we're stuck with it. Now the historical accident theory is pretty obvious: it could have been an Algol, Fortran derivative instead of C, if only UNIX used that as a basis. C itself could have been designed differently, and if so would probably have different flaws and qualities. Asking for a Rust/Go/Whatever OS is dishonest, because you know full well it will fail for reasons that have nothing to do with the underlying language's intrinsic qualities: even if that OS is great, nobody expect it to be so great we all have to switch away from Windows and Linux. Well, except maybe if we prove the correctness of the kernel, hence ensuring the absence of many vulnerabilities. Research is ongoing, I'd like to see where that goes.
- ArkyBeagle 10y agoC got ubiquitous well before Linux, at least. I'd date it back to the '80s on microcomputers ( mostly meaning DOS) . Lots of Pascal, but Pascal really was an engineering constraint at the time if you were doing actual system programming. And back then, that was a serious consideration.
- pjmlp 10y agoNot in Portugal, we were using mostly using Turbo Pascal. In the 80's using C on MS-DOS, was only seen by those that had UNIX at work or universities and wanted to work home. It wasn't even C, rather SmallC or any other K&R dialect. In any case, everyone that cared about performance was using TASM and MASM, writing everything in Assembly.
- DonaldFisk 10y agoThose who did something include the developers of Burroughs MCP, who used Algol 60; the developers of MULTICS, who used PL/1; the developers of Symbolics Genera, who used Lisp; and the developers of Oberon, who used the language Oberon. I go along with historical accident to account for Unix's success, though Richard Gabriel thought it was a case of Worse Is Better trumping The Right Thing.
- sacado2 10y agoThe Oberon operating system is as old as linux, yet I'm pretty sure you use the latter more often than the former.
- pjmlp 10y agoBeing an UNIX clone available for free instead of having to pay for expensive Solaris, Aix, HP-UX, SGI workstations, while BSD was busy fighting AT&T helped. UNIX is the VHS of operating systems.
- buserror 10y agoYeah, again and again. it's like blaming a hammer for the potential of breaking your finger when you use it, and proposing the use of a spoon, instead.
- grabcocque 10y agoIf the handle of the hammer you're holding was a chainsaw that randomly turns on and off. And also sometimes explodes killing your entire family and pet dog. Don't blame the explodey-chainsaw-hammer, it's just a tool. Okay an idiotically dangerous too that nobody in their right mind should use, but still just a tool.
- geezerjay 10y ago> If the handle of the hammer you're holding was a chainsaw Except it isn't. It's just a hammer, with a handle of a hammer. > And also sometimes explodes killing Except it doesn't. At best, some people are reckless and end up causing problems due to their recklessness. Enough with these silly hyperboles. Cushioned environments lead to less problems.
- quickben 10y agoEh, no need to overreact that much. Look. Hardware is hardware, and this is where tire meets the road so people can lay the foundation for the upper levels. It is what it is. It's not user friendly because hardware just isn't, low levels aren't, and it has to just perform. > 'idiotically dangerous' Well, I don't want to sound harsh, but nobody forces anybody to do systems programming if they perceive C as such. There is JavaScript, python and plethora of other safe and cozy languages, but: the low level has to be done.
- grabcocque 10y agoOh, I see it's not that there's such a thing as a bad tool, or that C is unsafe. Simply most of us don't have your towering intellect to appreciate it. Got it.
- dep_b 10y agoWith modern day computing power and compilers there are better ways to tell the computer and explain your fellow programmer what you want the computer to do. In the end giving in the same (or even more efficient) CPU instructions. Sniper rifles are improving every year. Yet a rifle from the 40's can kill people too. Both deadly in the hands of an expert and dangerous in the hands of an amateur. It's the same with C. You should be able to understand the computer on that level but you don't need C just to prove it.
- stinos 10y agoIn the end giving in the same (or even more efficient) CPU instructions. We both know that is not always true and heavily depends on the type of software though.. Take https://github.com/micropython/micropython https://github.com/micropython/micropython for instance: what higher level language but C would allow that to run with the same performance as it has now, on as much different devices? C++ would be a viable answer, but when used e.g. as C + templates it's basically still a form of C and anyway your complaints have been raised in nearly the exact same wordings about C++ laguage as well..
- pjmlp 10y agoTurbo Pascal, Think Pascal, Quick Pascal, FreePascal, Modula-2, Ada, Delphi, MikroElektronika Pascal The availability of compilers for a specific architecture is orthogonal to the language.
- stinos 10y agohmm got me there I guess. Never looked closely into those, can you summarize in what way thay are better than C? Less shoot-yourself-in-the-foot maybe?
- pjmlp 10y agoYes. Pascal dialects already in the late 80's, early 90's, allowed for: - type safe sub ranges - proper strings - type safe enumerations, enumerations as vector indexes - type safe allocation (new vs malloc) - type safe out parameters via references instead of pointers - bounds checking and checked arithmetic (you can explicit disable them if required for performance) - real modules via units - pointer arithmetic is more explicit As for MicroPython, MikroPascal from MikroElektronika supports all those tiny chips. http://www.mikroe.com/mikropascal/ http://www.mikroe.com/mikropascal/
- randta 10y agoI just think that C over the years has had more bashing than pragmatic advocacy for where it excels and as a result, there is a very knee jerk reaction to the language itself. On the other hand, where the language gets promoted, I haven't seen anyone really promote C in a way that would sound modern in any sense, where people who have years of experience with C stick with C89 or use C99 in a C++ compatible fashion (i.e. without any C99 syntax which C++ has not adopted officially like restrict keyword or designated initializers). While that is fine for personal preferences, I think it does a disservice to people who have to learn the language and use the language for various justified reasons of their own and there isn't a unified response in how to really teach C to them. I think the author really hits the hammer on the head with this part in the introduction. "In contrast to the ubiquitous presence of C programs and systems, good knowledge of and about C is much more scarce. Even experienced C programmers often appear to be stuck in some degree of self-inflicted ignorance about the modern evolution of the C language. A likely reason for this is that C is seen as an "easy to learn" language, allowing a programmer with little experience to quickly write or copy snippets of code that at least appear to do what it’s supposed to. In a way, C fails to motivate its users to climb to higher levels of knowledge." But on this book, from what I have read from past revisions, it's very well written and I have even learned some things from it I didn't know existed in C, like using the keyword static in array indices in parameter declarations. While it is not a perfect resource and I don't think anyone new to programming would be able to read this without guidance, it does some things extraordinarily well which I haven't really seen other C books touch on. Its treatment of undefined behavior is top notch and the way that it tries to explain the memory model of C is pretty good as well. But had this book been written for another "antique" language, like Modern Fotran or Modern Cobol (which both had their last ISO standards most recently in 2008 and 2014 respectively, mind you), I doubt there would be this much polarization in the comments section.
- JustSomeNobody 10y agoHN prefer Javascript, it seems.
- cwbrandsma 10y agoAny every other language out there. It is far easier for people to identify with what they don't like than it is to identify with what they do like.
- wangchow 10y agoAnd.. While they express such distaste the haters probably serve their web apps via NGINX.
- accatyyc 10y ago... and put all their keys and values in Redis. And use curl for testing their revolutionary REST-API!