- #Python is written in C
- #Perl is written in C
- #Ruby is written in C
- #PHP is written in C
- #JavaScript engines started in C, now mostly in C++
- #Go was first in C, now written in Go itself
- #C++ compilers are written in C++
- #Swift is built with C++ and Swift (on LLVM in C++)
- #C# runs on .NET, built in C++/C#
- #JVM (HotSpot) is written in C++

Yet, people still doubt the necessity of learning C!

@mirsadra photo is of the book I learned C from. classic
@mirsadra I've got a Kerigan and Ritchie, a very important book in my career.

@trigpoint @mirsadra I met them both at different times. Once got Dennis to allow a chant of, "C is bad" at Bell Labs. Once got Brian to say that the C string functions were, "Dennis's code."

Both men were excellent technologists. I was proud to have met them.

@mirsadra C was written in assembly therefore all programmers necessitate learning it?

not trying to be an asshole but this isn't the best argument in favour of it

you could say all languages use C via FFI, for example, which is neigh impossible to directly do Java <-> Rust or C++ <=> Rust without going through C first

@diegovsky @mirsadra yeah, every programmer should how assembly works and what it looks like. Knowing those building blocks helps you understand how computers work and leads to better code in higher level languages.

It also helps you appreciate all the abstraction built into those higher level languages.

@jrdepriest @diegovsky @mirsadra This.

Most programmers will not need to use C in their day to day life.

But most programmers would benefit from getting a copy of the K&R, and doing the exercises as they read their way through the book.

It will improve their grasp of the foundations of what they do, even if they never write a line of C again.

@jrdepriest @diegovsky @mirsadra I agree and disagree.
I agree that knowing low level well allows you to have a better understanding for creating high level stuff.

But I would argue that we should have high level abstraction that would work well without having to know all the layers from pixels on your screen to assembly on your CPU and TTY obscure knowledge.

Making it an obligation to be a good coder is a sad consequence of poor UX.

@dolanor @jrdepriest @diegovsky @mirsadra
To be a good programmer, you need to understand what is happening : on a physical level, on a software layers and ecosystem level, and on a mathematical level.
Every ones of those axis are retroactively linked, and you are embedded in them.

Then comes your particular toolset abstraction, allowing to construct some stuff better.

You don't need to be a good programmer.

(And C is not a very interesting language, just the *langua franca*)

@diegovsky @mirsadra the original C compiler was not written in assembly, it was apparently derived from BCPL then B then NB (new B, iirc). https://www.nokia.com/bell-labs/about/dennis-m-ritchie/chist.html

@mirsadra Ooh, the K&R bible. I loved that book. Even the introduction (from memory) „C is not a big language and it is not served well by a big book“. True. Such a good book.

Still, not sure whether everybody needs to know C today. I find it tremendously useful because if you know C you know how computers REALLY work, where many programming languages today abstract so far away from the gritty details of memory management, pointers etc that you can program without knowing how the machine works.

@Mastokarl

@mirsadra

> because if you know C you know how computers REALLY work

Nope. You know how your computer REALLY work, if you make it yourself from scratch. By designing your own chips.

@mirsadra All of them are eventually assembly and then machine code. Should we all learn asm? Which one?
@drq @mirsadra I mean 6502. Duh.
@drq @mirsadra I will say that once you master that, the Motorola chips beckon. So clean.
@drq @mirsadra If it's to grasp the fundamentals, then it doesn't matter that much which one - one of the simplified virtual assembly languages (often used by students creating a basic compiler as a project) are probably satisfactory for this.
@mirsadra there should be a license requirement. Fail the test? Python for you, pal.

@mirsadra #C++ was written in #C until it could self compile. Also add...

#Erlang written in C
#GNUAda (GNAT) core written in C
#BSD kernels written in C
#Linux kernel in C

The body of software written in C is enormous and it "ain't" going to be ported to Rust, Go, Java, or other over night. And one needs to understand C in order to port from it.

I love C.

@sirwumpus @mirsadra there's no need to port to Rust. #Rust is a great language with great tooling, but the philosophy is kind of outdated already.

Instead, use modern tools to make your existing C code "safe". Like: https://fil-c.org

If one wants to port or write something new, use a modern language that can be formally verified by design. Like #Idris 2: https://www.idris-lang.org/

#cprogramming

Fil-C

Oh, I haven't heard of "Fil-c" before! It looks very interesting! 👀
Do you have any experience with it?

@sigismundninja @sirwumpus @mirsadra

@duke_of_germany @sigismundninja @mirsadra None myself, but I've been keeping track of potential similar solutions; often The Register has articles.

Probably others I've missed.

Enterprise Technology News and Analysis

Enterprise technology news for IT decision-makers and professionals

@sigismundninja @sirwumpus @mirsadra One problem: #Fil-C is garbage collected, cannot be used for bare metal programming. #Idris looks Haskellish, I don't think that would appeal to most programmers.

@michalfita @sirwumpus @mirsadra it's for sure not suitable for every use case. Hard real-time might be a no go. I guess it depends on if the multi threaded GC can run deterministic on a (POSIX compatible?) RTOS. I know too little about embedded Rust and the heap, but my guess is it's not very suitable for super hard real-time? But most software written in C does not have real-time requirements.

I agree, the ML style isn't for everyone.

@mirsadra

Let me guess, you've been bombarded by Rust evangelicals? 

@mirsadra Would be nice if I could get paid to write it at least once before I retire.
@mirsadra I used C to write an assembler one time and the space-time continuum nearly collapsed.

@mirsadra I would argue that not everybody need to create or participate in those language compilers.
The compiler is just a tool to create software that should improve life.

So if you're building a web app in perl that allows to save lives in whatever context, I don't care that you didn't know C enough, you did a good job to help your fellow living beings.

Otherwise, you can add that TypeScript is being rewritten from TypeScript to Go.

And a bunch of languages have been written in Go as well (they are less known, for sure)

@dolanor You are 100% correct, and this is the most important point. The ultimate goal of any tool is to solve human problems and improve lives. A life-saving Perl web app is infinitely more valuable than a perfectly optimised "hello world" in C.
@dolanor My argument was never that everyone must know C to be a good developer. It's that understanding C is one of the best ways to understand the how and why of the tools we use. It's about depth of knowledge, not a prerequisite for making a positive impact. You can be a brilliant doctor without knowing how to synthesise penicillin, but the knowledge of how it works makes you even better. Isn't it?

@mirsadra
When I was working on a project at work a while back that needed to use C++ a Java engineer coworker commented something like "I didn't think anyone really used that anymore"

My reply was "Someone has to write your interpreted language runtime for you"

@elfieclaire And, thanks to them, people can argue that 'we don't have to know it.'

That's the entire point of good engineering, creating robust abstractions so the next layer doesn't need to worry about the implementation details. The fact that we can have that debate is a testament to the success of the systems programmers who build our foundations!

It’s not about what you need to do to do your job; it’s about what you can understand to see the full picture.

@mirsadra you def don't need to learn c lol

c is implemented in assembly, so you need to learn assembly??

assembly is implemented by transistors, so you need to learn circuits??

There's a level of abstraction that people stop at, and over the years it's probably averaging higher rather than lower

@danvolchek Perfectly said. We all stop somewhere. The case for C is that it's the most useful foundational abstraction to understand. It explains the cost model and constraints that every higher-level language is built upon. You learn it not to write it every day, but to understand everything above it better.

@danvolchek @mirsadra

why stop at transistors though? that's so superficial. And you left out the whole layer of microcode!

transistors are implemented in solid state physics, so better learn your single electron approximation.

solid state physics is just a bunch of quantum mechanics, so have fun solving the hydrogen hamiltonian.

now we might be at the end: you certainly need a bunch of mathematics, but you could argue that quantum mechanics isn't made of mathematics, it's just using math

@danvolchek @mirsadra: I feel that a good CS course should at the very least cover the basic building blocks of fundamental gates from transistors, along with how the gates can combine to form basic elements like flip-flops and adders and the rudimentary elements of some sort of assembly language. It doesn't have to be a laborious full-on experience, but it helps to have that holistic view of the computer.
@mirsadra learning C or variants will set you up. But so will Rust, frankly, and it's got a much friendlier (tools, not people) ecosystem.

@mirsadra

I wrote one C program in my professional life, and I never understood why it blue-screened every time it ran.

to be clear: the problem was not with the language, it was with me.

the language is perfect.

@mirsadra literally reading a PDF of this as I type here
@mirsadra FINE i will LEARN IT
xyhhx 🔻 (plz hire me) (@[email protected])

should uh ... should i learn c?

Kim-Jong Cracks Social
@mirsadra i took ansi c in college's class

@mirsadra I think C should be learned for the following reasons:

1) Understanding the memory model and the ABI
2) As a cautionary tale

@mirsadra I'd be super interested in your take on the tabs vs spaces debate
@mirsadra Most micro controllers are programmed in C or C++. I suspect a lot of newbies to Arduino programming get surprised by that.
@mirsadra I mean, oh duck off. *Rust* is written in C (llvm)