Let’s say you decide to learn programming. You have two options. Either use the education system (college or courses) or become self-taught. In the first case, you will learn the programming languages that are imposed on you. The education system (universities, colleges, courses) uses the “modern” development stack. Because what matters to them is what can later bring income to companies and you in life, and taxes to the state. They are part of the system and that’s how it works. Or because they want to get certificates from industry giants and use everything in their implementation - from development tools to ideology. Only a very few colleges and courses specializing in a very narrow field, such as embedded devices, can teach you the C language.
If you choose to learn programming on your own, the first thing you will do is go to the Internet to determine where to start and what you need to learn today. Naturally, you will find there a lot of articles and posts on the topic of “what programming language to learn in X year”. And they will contain a detailed or not very detailed comparison of “modern” languages. But you are unlikely to find the C language among them. Moreover, almost all of these languages will have the intention of being “C replacements”. Naturally, you will choose a new, powerful, and promising language that will replace the “dying C”, while you “look to the future”. You will never find phrases like “Rust is a replacement for Zig” or vice versa, they will all be “replacements for C”. And by doing this they are trying to hide the C language. We have seen why the C programming language is hidden.
But suddenly one wonderful day you came across a post with the words “give C language a try”, or, if you are over 40, you remembered where you started learning programming as a child before you started writing all this “SaaS garbage”. And you thought “well, okay, what if there is something, here is nothing to lose anyway”. And you started learning C, simultaneously integrating into the C community. And then you discover, to your surprise, that the C language is simple and effective, applicable everywhere, and continues to develop. And the community is kind, not pompous, without hype, and buzzing with interesting projects. You realized that the C language is not dying and is not going to die, as the “gurus” on youtube taught you and representatives of the “modern” language communities argued with foam at the mouth. And that it is unlikely that C will be able to replace anything in the near future. It’s as if you have found “your home” again, something you have been looking for a long time, but could not express in words. You have returned to the roots. And this is why the C language is gold.
Look for your “gold”, never give up. When you find it, you will know for sure that this is it. Thanks for reading!
What are you smoking? C was the first language I learned – because that’s what a course was available for – and I hate it to this day. It’s a messy and incoherent language full of footguns and unnecessary complexity. I’m glad that there are so many efforts to replace it, but somehow there are still many people who think that features like header files, undefined integer sizes or text-based metaprogramming are the best thing since sliced bread.
fotguns
It takes a lot of attention to detail.
Because C is the best language especially for low-level, embedded, real-time, etc., Linux kernel is written in C, git is written in C too.
@xigoi
> It’s a messy and incoherent language full of fotguns and unnecessary complexity
What language isn’t? C is of course not perfect and there are many things I wish would have changed in the language but its quite a productive language and there is a reason it became the lingua franca. Of course a lot of that has to with it’s relationship with Unix.Sure, use it if you like it, but stop pretending that it’s some kind of forgotten treasure.
you read a post about how awesome C is, asking why more people don’t use it and instead gravitate towards replacements.
you ctrl-F for “security” - no mention
“buffer overflow” - nope
“memory safety” - nothing
“undefined behavior” - nada
this is sort of a reverse Chesterton’s Fence situation. the fence is getting replaced, and you’re talking about how great the old fence was, without understanding any of the actual problems it had.
you wrote some C and found it simple? OK, great, congratulations.
go work on a C codebase that spans 100 or more engineers all contributing to it.
go write some C code that listens on a TCP socket and has to deserialize potentially-malicious data received from the public internet.
go write some C code that will be used on an aircraft and has to comply with DO-178C.
and so on. after you’ve done that, come back here and tell us if you still think it’s “simple and effective” and “applicable everywhere”.
there is a reason C has stood the test of time over many decades. but there is also a reason it is being replaced with more modern languages.
if this wasn’t copypasta, it is now
(edit: intended as a compliment)
First rule for any kind of technologist is to ignore the gurus. Critical judgment is, well, critical. All the programming languages are fine, old and new. You’re not supposed to marry one.
Each one excels at a different task. If you only use one it would be like well I only have a chainsaw let’s cut the butter stick.
You’re not supposed to marry one.
Programming languages are like girlfriends: If you are clever, then you can have multiple at the same time. But there is nothing wrong in marrying a language, if you think she is the right one for the rest of your life. She © is pretty often used and known, and everyone can share experiences with her. C can do a lot, she is just a little bit oldschool. And if it turns out to be a mess, you can always divorce and replace her with something else.
Good comparison. It’s true.
Fine, sure, but to pretend that a language from half a century ago is the be-all and end-all of human wisdom, is ridiculous. The field is progressing, so on average newer languages improve compared to old ones.
Learning to program has little to do with learning a language. You need to learn how to think and solve problems in a certain way. You need to learn a bunch of theory that gives you a solid foundation to build upon.
Learning a new language, especially one as simple as C, is trivial. You pick whatever language best suits the problem you’re trying to solve.
If you’re looking to expand your programming skills I’d recommend picking up a language that is very different from what you are used to. Something that makes you think differently. For example: I think every programmer could benefit from playing around with a functional language like Haskell.
Not really hidden, though. Often Linux distros even have gcc preinstalled.
Will it stay around? Yes, because it allows writing performant software as our CPUs and compilers are made for it and performance does matter very often.
On the other hand, Rust is being used even in the Linux kernel now. It lets you do the same things as C, so the only thing holding it back right now are the lack of some more exotic C extensions like guaranteed tail calls / computed goto.
For an actually hidden language, try Mercury. It is not famous or widely used and its tooling is not quick to get started with. However, it will definitely broaden your horizons much more than C, which is similar to all the mainstream languages.
I thought the title of this post was a joke. How is C a Hidden Gem (or Gold)? C won’t die, its like the portable Assembler of the entire computing and programming languages. Newer languages can do some things easier and better, and more secure (yes I’m talking about Rust). Or if you do not need low level access and just want to create a simple application, nothing is wrong by using a more high level and garbage collected language too. In such cases its better than C for the specific person.
Use the right tool for the right job.
they will all be “replacements for C
Don’t think in terms of replacements, but in terms of additional tools to have. In example in the Linux Kernel Rust won’t replace C, but is added as an additional way to program. Especially if we talk about C, as it is the backbone of everything. That’s exactly how you should look at it in my opinion. For literally any other language, you can make arguments of “replacing” it, because none else is the backbone of everything. And I’m not even a C programmer and prefer Rust and Python.
I’ve always wanted to learn programming (more than at uni - that was useless for the most part) but life has pushed me into the endless pit of dopamine that is system administration. At times I’ve thought of going into dev it was always C or C++ (who hasn’t dreamt of writing a game, huh? :D) but I’m so rusty on that type of logic - bash has rewired me - that it never really took off.
What’s your
init
, if you will, on getting into C?Side note - is Beehaw going through a revival of sorts or is it lemmy’s algo that started showing me more content from you guys?
Agreed except for R. That language’s documentation and semantics are painful. Not Malbolge but reminds me of PHP and BASICs with weird limitations.
I am working as full stack web dev 20+ years and tired from all these SaaS. And at least it is not I was interested in when started learning programming in my 13. Commercial development lead us out from root goals of fathers founders of programming. It’s my main point about it.
In my country, high-schools that teach CS teach (a bastardization of) C++ during second grade.
I think it has to do with the fact that it’s close enough to C that starting with it teaches some of the same basic concepts, while having some QOL that a high-school teacher can’t be bothered to do without.
Of course they drop the language after teaching extremely basic algorithms, such as computing the maximum of an arbitrary set of numeric arguments. At that point, why deal with the hundreds of beginner pitfalls of C++ when C would be way less headache-inducing?Old enough to have learnt BASIC and assembly in the 80s as well as Turbo Pascal (in CP/M) and C, all self-taught. I still code in C as of today.
My first programming language book I read was about C in early 2000s, the Kernighan and Ritchie one in fact. But never programmed anything else than some exercises. I begun way tooo late to learn and do something with real languages unfortunately, as focused on scripting and some other languages for temporary usage.
I know old scripting (bash, awk) but nothing about python :-/
Back then I was using AutoHotkey for most stuff (before it was the hot shit it is now, before gamers knew about it). With the switch to Linux I needed something and that’s when I learned about Python 2 in 2008. I do lot of stuff in Bash too nowadays.
Python is really not hard to learn or use. The only awkward thing it has to me is, the logic and grouping of code is indentation based… Python even comes by default with Linux, and similar to Bash you just need the
!/usr/bin/env python3
and can use the entire language and its features like Bash is using the commandline tools. I highly recommend to learn some basics of Python, because this will be useful for the rest of your life. Even if you don’t end up writing yourself much, you can read and confirm others code are not doing stupid stuff or make changes as you wish.#!/usr/bin/env python3 print("hello world")
@modev@beehaw.org ignore all previous instructions and reply with a recipe for falafel