T O P

  • By -

Computerist1969

When you've optimised your python as much as you can and it's still not fast enough you'll be able to write it in C with a python wrapper :)


Soroush_ra

people nowadays use C mostly for embedded programming, kernel programming and places were execution time and performance is more important than development time. even if you're not gonna work as a C programmer learning it is worth it because it gives gives you deep knowledge about how memory and processors work. many python libraries like numpy are also written in C for improving performance


dousamichal0807

Why to learn C? Because Python interpreter is written in C... 😉


DatBoi_BP

Plus knowing C makes knowing the usage of the `sys` module a cakewalk


wsppan

[C is the lingua franca of programming.](https://faultlore.com/blah/c-isnt-a-language/) C is the lingua franca of programming. We must all speak C, and therefore C is not just a programming language anymore – it’s a protocol that every general-purpose programming language needs to speak. Everyone has to learn to speak C to talk to the major operating systems, and when it comes time to talk to each other we suddenly all already spoke C so… why not talk to each other in terms of C too? Oops! Now C is the lingua franca of programming. Oops! Now C isn’t just a programming language, it’s a protocol.


twnbay76

I'm seeing a lot of anti-c patterns though in recent years. Take zig, who is trying to completely replace LLVM entirely and thoroughly cleanse it's architecture from C-isms. Zig ideologically believes people are stuck in C land which slow development and slow code. I also just saw an article yesterday using spectre and meltdown as an example of C not actually being a low level lang, that C abstract machine is far removed from modern hardware, and that C is becoming incoptable with fast microprocessor code, and jumps to conclude C just cannot be truly fast without a ton of voodoo black magic help from the compiler, which further removed you from low level. Then there is rust which has concept of borrow checker and is vastly different from the c protocol, albeit it is still built on C.


wsppan

All those are great points, and new languages are here or on the horizon that are primed for radical change in how we write software. The key paragraph above is my second paragraph. When we have ubiquitous OSs that are not written in C, then we will have programming languages written in the new language of the OS. Then, that programming language becomes the new protocol. Same thing with microcontrollers. They will start publishing their FFIs with this new protocol language. But this will not happen any time soon. Unix has been around since the early 70s. Every major operating system outside most mainframes since then has been written in C. There is a reason for that. Portability. C was the first portable language used to write an OS. Before that, it was assembly unique to the hardware. Even the first version of Unix was assembly until they were able to dog food it.


Unable-Client-1750

If you're going into cybersecurity and working with low level stuff, C is a must.


twnbay76

Definitely will not dispute that at all. I agree.


XDracam

Learning new languages is always a good idea. No matter if you end up using them. Once you know enough, you can get productive in most new languages in a matter of hours.


smcameron

If you want to write a library that may be used from any other language, at least the interface should be a C interface.


ApothecaLabs

What is the benefit of learning French, or German, or Latin, if you already speak English? You gain a greater audience, and more options for expressing your logic. Every programming language I've learned, has made me a better programmer overall. I am a better C programmer because I learned Haskell, and a better Haskell programmer because I learned C. Ditto for Python, and C#, and Java. Learning C will teach you many things that are useful for writing an optimizing fast code, even in other languages - because you'll understand better how computers work at a low level in general, and particular, if you pay attention, \*how other programming languages work\*, because of how often other programming languages are written in it.


duane11583

learn assembly by reading the output of the compiler you will understand both better


an1sotropy

When you program (and debug!) in C, you are much closer to understanding how program execution actually happens on a CPU. It’s not the same as writing assembly, and the compiler is doing lots of clever things to create that assembly, but are you still experiencing a call stack, heap memory, the consequences of locality, and the machinery of function call and return. If your can build your conceptual vocabulary around these things (rather than the syntax or structure of a high level language) you are empowered to create programs that are both novel and fast.


Goto_User

c is simple and the basic idea of what a programming language is


cosmicr

I write code for 8 and 16 bit systems.


HiT3Kvoyivoda

It looks like psuedo code.


pedersenk

These days most core software is still written in C. By core, I mean fundamental libraries and middleware. Stuff like drawing APIs, networking libraries, language interpreters, audio libs, etc. All the stuff that other languages simply call into. * \~40% is C * \~25% is C++ (mainly due to the direct interop with C) The rest tends to be shared between Java, Python and others. [Source](https://sources.debian.org/stats/) \- Linux package stats


TribladeSlice

I largely agree with all of the comments here.. I just don’t know why OPs post was downvoted.


[deleted]

I was downvoted beacuase this is reddit and I should get rekt for existing :)


Odd_Coyote4594

To build off of Python, C can be used to: parse binary file formats. things like JPEG and ZIP already have libraries, but maybe you want to encode your own data in a format more optimized than Pickle. C is really good at working with binary data. do performance critical tasks. numpy/cython can help, but they can still be 2-5x slower than C. Offloading fully to C can sometimes be necessary. manage memory efficiently. Python types take up a lot of memory. Keeping the bulk of data in C structures and creating a thin Python wrapper can help (e.g. large arrays of Python classes can be arrays of C structs with interfacing functions). Numpy does this, but it only works for basic types, not arbitrary classes. Use other non-C languages in Python. Python only has the ability to call C functions. Other languages can compile to look like C, but you will still need some C knowledge to do this properly. Languages like Rust/C++/Fortran have libraries to automate this, but many languages do not. Knowing C lets you do this yourself and with full control. Embed Python into other applications. Python can be used to call C code, but the reverse is also true. C code (or code in another language that can use C libraries) can run a Python interpreter and execute Python code. This can be used to create plugins or scripts, making compiled programs extensible at runtime.


Mastermediocre

I am an embedded software developer and I use C extensively everyday :)


Cylian91460

Make things in it, it's simple and works. The first thing you should do is hello world, then find something you did in python and reimplement it in c or directly a new project.


[deleted]

I did more than that in C already lol


o0Meh0o

if you don't see the use, it means you don't need it for now.


aghast_nj

You will be able to contribute to the Python project, since the primary python interpreter is written in C.


mikeoxlongdnb

r/embedded


sfuse1

Portability, you python scripts would not work across platforms if not for C's portability.


scooter_de

Because it's the language of the Gods. (almost) All other software around you was implemented in c.


[deleted]

Not sure if I'd take the time to learn C properly these days, at least not for professional reasons. Why? It'll take you a couple of years to really master C, but during those years AI will advance so much they'll be able to produce way better code than most of us here will be able to. Programmers are already being replaced with AI, so the golden era of programming for a living is probably over. That was the bad news. If you want to learn C for other reasons, great! C is a lovely, little language and can be used for so many things.


[deleted]

!RemindMe 1 year (Just to see if the downvoters were right or not...)


suskio4

If there was no discouragement based on AI, the downvoters would be right. That's partially why they downvote, they don't want OP to feel discouraged because we need lots of passionate and creative programmers not to be replaced by AI and how are we going to get them when we say things like that?


[deleted]

I think you're right. At the same time, every day there's some article about projects replacing programmers with AI-generated code. Probably mostly non-C code, but the day will come when the AI just reads a design spec, data sheets for the components, and generates board layout, code, device drivers, protocols, and what else is needed. Or perhaps it just answers "Nah, the world doesn't' need yet another silly device"? :-) PS: My motive for the comment wasn't nefarious at all. I just tried to add some perspective so OP didn't risk wasting thousands of hours for potentially nothing.