4 ms·
It was a very sad day for computing when Ritchie released this brain fart upon the world. I think this "invention" called spiral rule is one significant reason
by leaveyou 12y ago
It was a very sad day for computing when Ritchie released this brain fart upon the world. I think this "invention" called spiral rule is one significant reason why so many good programmers who know or knew C at one point don't use C in their projects and will never contribute to open source projects written in C.
- cockcruncher 12y agoCould you provide some source on that bullshit?
- leaveyou 12y agoThe source of the "bullshit" is in the beginning of the second sentence: I. I dared to have an opinion based on my observations regarding the effort needed to decipher a C declaration combined with my conviction that my cognitive abilities are similar to those of other programmers.
- outworlder 12y agoNowadays, it seems difficult to understand how could someone invent something so... awkward. However, keep in mind all the other constraints he had at the time. Inventing a sane syntax probably took a backseat () Now, the bigger issue is why is the C syntax surviving. I blame Java and now Javascript. This will only get worse as more people get to know it. At least javascript doesn't have so many type shenanigans: try parsing in your head a pointer to a C function that takes a pointer to a struct or something. Still, C is a pretty nice fallback when you have nailed your algorithm and must absolutely get the last drop of performance (and want to still reason about what the compiler is doing, so C++ is out). Or when you want to interface with anything written in C. () Then again, he could just have done a Lisp and removed almost all syntax.
- xg15 12y agoI'm no C expert, but couldn't you contain the madness for a good part with a sane code convention and smart use of typedefs? It looks to me as if the part where everything breaks down is mostly with "nested" function pointer types like in the "ultimate" example of the tutorial. (The syntax of "simple" function pointers is quirky as well, but without recursion, you might get the hang of it after a short time) So, couldn't you avoid much of the confusion by mandating that function pointers may refer to other function pointers only through typedefs? Of course this wouldn't work for legacy code...
- outworlder 12y agoYes, that makes it slightly saner by not having to parse the declaration in your head all the time.
- bjz_ 12y ago> Now, the bigger issue is why is the C syntax surviving. I blame Java and now Javascript. This will only get worse as more people get to know it. Thankfully Swift, Rust, Go, Scala, Typescript, and AtScript are all doing away with the spiral declaration syntax.
- SamReidHughes 12y agoJava syntax doesn't have any of the spiral type parsing behavior that C's has. So it's unclear what you have to complain about.
- Iftheshoefits 12y agoOn the other hand there are so many good programmers who aren't bothered by the syntax and will continue to contribute to projects written in C, open or not. Some of us enjoy programming in C and C++, and many of the programmers in that group are very, very good.
- nine_k 12y agoI applaud them and wish they didn't have to jump through some of the syntactic hoops which C makes them to.
- nnq 12y agoWhat other language would you use for an open-source project, if you wanted C-level performance and the maximum number of contributors? I think choosing D or Rust (or Go, but with it we'd already be a bit further from C-lever performance already) would seriously reduce the number of potential contributors. It's not a rhetoric question, I'd really want an answer as I'm contemplating the choice of language for and open-source project. And C++ is out because everybody has their own way of writing code in it and it's just too much work to police people into following a strong-handed style guide... ...so what would be left for an open source projects that has the goal of being able to squeeze the maximum performance without having to drop into a lower level language for the most performance sensitive parts?
- zomgbbq 12y agoC syntax really isn't that hard to understand, it has persisted for a reason, and I am quite happy when I get to write C. It's not the ideal language for web-programming but it is certainly the right language for a lot of things. Statements like "good programmers who know or knew C at one point don't use C in their projects and will never contribute to open source projects written in C" are just unsubstantiated fabrications.