You ever heard of lossless compression? Well they developed lossfull anti compression, it compresses and decompresses the images so many times that the added artifacts create a larger file than original ! Impressive ain't it?
Since getting all these structures right is critical for the GPU to work and the firmware to not crash, I needed a way of quickly experimenting with them while I reverse engineered things. Thankfully, the Asahi Linux project already has a tool for this: The m1n1 Python framework! Since I was already writing a GPU tracer for the m1n1 hypervisor and filling out structure definitions in Python, I decided to just flip it on its head and start writing a Python GPU kernel driver, using the same structure definitions. Python is great for this, since it is very easy to iterate with! Even better, it can already talk the basic RTKit protocols and parse crash logs, and I improved the tools for that so I could see exactly what the firmware was doing when it crashes. This is all done by running scripts on a development machine which connects to the M1 machine via USB, so you can easily reboot it every time you want to test something and the test cycle is very fast!
Good for testing and iterating, but what about performance? Though I guess getting everything right is more important right now, translating it into another language will probably require less work that way
I really like C because I can just get to the heart of an action and make it happen without much surrounding code.
I could make classes and blah blah blah if I want to make a large, complex program but I'd rather write several small, simple to grok programs which pass information around so each program can do its one simple thing, quickly and easily. Chain the small programs together with bash or something, and bingo, you've got a modular high speed system.
I'm not a programmer, actually a mechanical engineer. But the Unix philosophy of simple, modular tools is great, provided one properly checks and sanitizes inputs.
I agree with your main point. Python does a great job of replacing lots of tiny, chained scripts. Simple API calls with wget or curl have a place, but can spiral out of control quickly if you need to introduce any grain of control like with pagination, as an example.
Maintaining one Python app (or "script") can still adhere to the unix philosophy of simplicity but can bend some rules as far as monolithic design is concerned if you aren't careful.
It all boils down to whether you are introducing complexity or reducing it, IMHO.
Originally Windows was written in assembly and ran on top of DOS, but since Windows 2000 and XP, it's been exclusively running on the NT kernel, which is written primarily in C, with some C++ in there as well.
Or if your pulling 4 byte data from an AtoD converter and it's ordered 2, 3, 0, 1 for a fixed point value that you need to convert to a standard float at an extremely high rate or else the ring buffer will fill and you'll start losing data.
Well it is standard. The standard says that it is undefined behaviour. But I guess you are right that some compilers have non-standard options to make it not undefined behaviour.
Do people still think, after all this time and so many different languages, that there will be one language to rule them all? I mean technically you can drive nails with a rock, but you don't see a carpenter using one. Right tool for the job. Always was, always will be.
Right tool for the job, sure, but that evolves over time.
Like, years back carpenters didn't have access to table saws that didn't have safety features that prevent you from cutting off your fingers by stopping the blade as soon as it touches them. Now we do. Are old table saws still the "right tool for the job", or are they just a dangerous version of a modern tool that results in needless accidents?
Is C still the right tool for the job in places where Rust is a good option?
There's a project I could have written in Rust. Maybe some of the headache wouldn't have ever happened using Rust.
I also didn't know Rust at the time and it was a large project with unkind deadlines. I think the right tool for the job can also depend on available resources. So while the more unsafe, older tool I used caused a few small issues that Rust would not have; the project wouldn't have been finished if I'd used Rust.
I enjoy the selection bias in the comments for these sorts of posts. >_< There's a few people saying "I kinda like C", a few saying "use Python instead", and a whole lot saying "Rust is my lord and savior". Completely disjoint from the real world usage of the languages for whatever practical, pragmatic, or ideological measures they are used for.
I know barely anything about programming languages and only ask as a fan, what are the real world usages of languages and what are their practical, pragmatic, or ideological measures that they are used for?
I guess by real world usage I mean what proportion of code is being made with them. You should be skeptical of their accuracy, but there are measures for that. Like there is this one: https://www.tiobe.com/tiobe-index/, but it describes it's methodology as being about popularity based on articles, news, and other such things. Github publishes a very different chart as does RedMonk. Rust barely shows up on these charts, but Rust fans are very enthusiastic in threads like this. I like Rust well enough, but I also find the over-enthusiasm amusing.
By practical/pragmatic I mean the ability to target a lot of hardware with C. Sometimes the tooling is crap, but it's very universal. Being built on LLVM Rust can go onto plenty of hardware too, but it's probably not the tooling given to you by a platform vendor. It's also been around for a long time, so using Rust would mean a rewrite. Sometimes C is simply the choice. As for ideologically: Rust solves some pretty nasty programming issues, but sometimes I think it's fans over-estimate the percentage of real world problems it actually solves while ignoring that Rust can be more expensive to write. (shrug) Sometimes there's no such thing as a silver bullet.
Especially since sudo is generally quite short lived. Unless it is leaking a significant amount of memory waiting for authentication that never comes it is insignificant. It would actually be pretty easy to argue that sudo just shouldn't free memory at all. This would be better for security (all pointers live forever) and possibly faster as upon exec the kernel can just wipe all state rather than having free carefully account for the releases.
Ease of access to the underlying hardware in your programming language is only ever needed for embedded programming in the current year. Change my mind.
For years I wrote embedded C for 8 bit microcontrollers used in industrial controls.
Never again.
Rust is by far a better language for embedded. The only times I would consider it reasonable to write embedded code in C is if you're doing it for fun, or you depend on an existing and well tested / audited codebase or library and your application logic is less complicated than rust to C FFI.
Even then, you won't find me contributing to that effort.
Or micropython. That might sound nuts, but consider that Python was released two years after the 486 and two years before the Pentium. The RP2040 microcontroller has a far higher clock rate than those, has dual cores, and costs a dollar. It may lack RAM compared to some of those desktops at the time, though.
my controller may be old, but i only pay 20 thousands eurodogs for a board support pckage ,per user per ip per nation per year.
I dont even pay for their eclipse ide! C is the laand of free fuck yeah! My debug partner is compatible with only 200 euro per flexcable. Don`t tell em my debrugs parnter is not oem spec🐵.
every time i run into an issue with rust and i'm like "ah man it's so annoying the language doesn't have this feature" i go write the same thing in c++ or kotlin or something, and then i realize why i hardly touch anything other than rust or f#...
the lack of (generic) variadics, overloading, proper specialization, etc. in rust gets really annoying sometimes but it's an issue solvable with macros and/or weird trait manipulation (feels hacky but it's whatever).
I know I'm a fanboy, but I fell in love with C from the first time I tried it. I especially like its bare-bones grammar that never gets in your way. I appreciate how much it has taught me about how computers work. It helped me realize my aspirations to be an electrical engineer.
Primitive, provincial knuckledragging Americans/Brits/Right-wing country's citizens don't want to learn C or understand how their computer truly works. 😆
If you want to know how computers work, learn assembly and circuit design. You can learn C without ever thinking about registers, register allocation, the program counter, etc.
Although you can learn assembly without ever learning about e.g. branch prediction. There's tons of levels of abstraction in computers, and many of the lower level ones try to pretend you've still got a computer from the 80s even though CPUs are a lot more complex than they used to be.
As an aside, I've anecdotally heard of some schools teaching Rust instead of C as a systems language in courses. Rust has a different model than C, but will still teach you about static memory vs the stack vs the heap, pointers, etc.
Honestly, if I had to write some systems software, I'd be way more confident in any Rust code I wrote than C/C++ code. Nasal demons scare me.