4 ms·
>What’s so good about it? Well.. C is fast. Agreed! I also agree that K&R "The C Programming Language" is a classic book that everybody should read, at least t
by flavio81 9y ago
>What’s so good about it? Well.. C is fast.
Agreed! I also agree that K&R "The C Programming Language" is a classic book that everybody should read, at least to admire how well written is it. And of course C is a good language to learn. Not as a "first language" but as one of the "languages to know".
>Also, C is flexible. You can do more with C than you can do with newer languages.
What?! Yes, you can do anything with it, only if your time doesn't cost. The same is true of Assembly code.
There are many languages that are more expressive and powerful than C, and some of them aren't really that slow.
- runevault 9y ago-- And of course C is a good language to learn. Not as a "first language" but as one of the "languages to know". This is how I feel about it. Better to learn with something a bit more forgiving (IMO something like Python is good, even if these days I prefer compiled languages), but as a 2nd, 3rd, or 4th language C or at LEAST C++ should be required. Having to actually deal with memory yourself makes such a huge difference in how you treat your programs.
- orwin 9y agoI disagree. Some of my friend and me were able to implement by ourselves RB tree algorithms by the 18th day of our month-long formation, and only one of us knew how to write code before this (and we almost reached his level the day before, when we implemented linked list algorithms in C). After this formation, we were able to write a hashmap algorithm that handled collision in less than a day and a half. I honestly don't think we would have been able to do the same if the tools we were given during our formation were python, php or javascript. I don't think resolving the philosopher dinner problem in Go can teach you much. In C, it does. The biggest advantage C have is that you start from nothing, so you have to understand everything. I would not understand BTrees this well if i did not first understand linked list. And i think the thing that taught me the most about OOP was writing a raytracer in C.
- flavio81 9y ago>if the tools we were given during our formation were python, php or javascript. Well, these are not the "modern" tools I had in mind with writing my comment above... >I don't think resolving the philosopher dinner problem in Go can teach you much. In C, it does. Yes, I agree. But I never questioned C's value as a teaching aid.
- Tobba_ 9y agoI feel like in the end most of it just comes down to how memory is managed and the type system, at least if you consider C++ instead of C. Personally I just wish for something like C# without the garbage collector (and some good options for static compilation). Right now it just seems like the only two choices are C(++)/Rust, where your only option is to deal with everything manually even if the compiler or optimizer would know better, and most dynamic GCd languages, where your only option is summoning Cthulhu to do it for you.
- fileeditview 9y agoI have slight hopes for Zig. Maybe there will finally be a real C replacement. I never understood why C has not been brought into modern context. Go is probably nearest but it has GC and C interop seems cumbersome.
- Tobba_ 9y agoLooks like a mash-up between C and Rust, though with somewhat funky syntax. Still, C(++) with no preprocessor and non-nullable pointers is a huge improvement on it's own, but is that full-blown CTFE with first-class types I see? Hot damn. I could definitely see myself using that if it evolves further.
- flavio81 9y ago>, and most dynamic GCd languages In Common Lisp there are tricks to avoid doing dynamical allocations within your critical (read "requires high performance") code, so the GC doesn't bother you. Couple this with type declarations, "inline" declarations (which tell the Lisp compiler to inline certain functions) and, if you know what you're doing, the Lisp code will compile to pretty good (read: fast, optimized) machine language that will run seriously fast (at the same speed or close to the same speed than C or Fortran.) So you can choose to avoid needing the GC on your high performance code, and enjoy the comfort of garbage-collected dynamic memory management on the code that is not so performance-critical.