6 ms·
C is great. I never understood some peoples' desires to rewrite old stuff into new languages, just because it's a new language. X exists... and HN is then full
by ajsnigrutin 6y ago
C is great.
I never understood some peoples' desires to rewrite old stuff into new languages, just because it's a new language. X exists... and HN is then full of "X in python", "X in python3", "X in rust", "X in ruby", "X in go", "X in perl6" ... why? Especially with "new" languages, that lose popularity after a few years (remember all the ruby (-on rails,...) hype?) or languages that change with versions, and running old code in a new interpreter doesn't work (fscking python, and a bunch of python2.x code online that won't run on modern systems anymore, without a lot of work.... i have 20 year old perl books, and all the examples still work, even older C books, and everything works... but not python, "print foo" breaks in pyton3, not to mention integer divison that you don't even notice it failed, until something goes horribly wrong).
curl is written in C and JustWorks(TM), it doesn't need to be written in anything else.
</rant>
- cbdumas 6y agoThe stability and ubiquity of C are probably it's biggest upside characteristics and, as you say, there is a lot to like there. But you have to admit the language is showing it's age and has some huge flaws. To call manual memory management a foot-gun would be a ridiculous understatement. Once you've used a language with modules and namespaces, going back to C is so painful. The C standard library is super minimal and has lots of... lets call them... quirks. Basically lots of things that are easy and safe in any of the languages you mentioned are difficult and dangerous in C.
- randmeerkat 6y agoC is difficult to learn and the largest community to get involved in / learn from is the kernel dev community, which is notoriously hostile to newbs. I suspect if the kernel community was more friendly (less hostile), and mentorship was more common in the C community, you would see less people searching for an alternative to C.
- cozzyd 6y agoC is very easy to learn! It's difficult to use in some cases (e.g. string handling), but it's the right tool for a lot domains.
- randmeerkat 6y agoDo you have links for learning C that you think are good?
- cozzyd 6y agoWell, the way I learned C was by taking this class many years ago: https://see.stanford.edu/Course/CS107 https://see.stanford.edu/Course/CS107 (not this specific instance of the class, but same instructor so I assume the curriculum is the same...). There are surely more efficient ways...
- randmeerkat 6y agoWhat would you consider the more efficient ways to be?
- cozzyd 6y agoI'm sure there are good books... what are your goals and where are you starting from? C syntax is very simple and there aren't a huge number of concepts you need to learn (memory layout, pointers, the preprocessor, casting). There are tons of projects written in easily-understandable C. cpython is one.
- randmeerkat 6y agoI already know higher level languages like Python, Java, and a handful of others, but never really dove into C much beside the Kernighan Ritchie book years ago. I was able to do some stuff with an arduino with it, but my goal was actually always kernel development, or maybe rockets at SpaceX.
- cozzyd 6y agoIf you want to get into kernel development (something I have no experience with except reading headers for various userspace interfaces), perhaps starting with an education OS is good. I did take OS in undergrad and that was probably where I got most familiar with C. This might be a useful place to start: https://web.stanford.edu/class/cs140/projects/pintos/pintos.html#SEC_Contents https://web.stanford.edu/class/cs140/projects/pintos/pintos....
- ajsnigrutin 6y agoC is pretty easy to learn, and the larges community is probably the embedded/maker one (with some c++.... micropython is slowly crawling in tho).
- randmeerkat 6y agoDo you have links to good resources for learning C and the communities that would be more welcoming?
- cozzyd 6y agomicropython targets huge microcontrollers. I guess for makers that's not a huge deal though.
- mbrodersen 6y agoNot my experience at all. C was super easy for me to learn. However, having said that, I did learn Z80 assembler programming before learning C. That might have made it easier.
- Blikkentrekker 6y agoI find it quite easy to understand: C is not great at all. Rarely is something so dated, that was not created with the benefit of more modern insights very good. Writing in C not only introduces the possibility of many bugs, but is also a menial chore of boilerplate.