What language was that jpeg compression written in?
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?
we do live in the future
Impressive
and the Nobel goes to some nerd playing with electrons. Unbelievable
Potato
YOU WERE NEVER MEANT TO ACCESS STARCH DIRECTLY
Fools haven’t even written it well! Translated:
STOP WRITING
-
MEMORY WAS NEVER SUPPOSED TO BE AESSED DIRETLY
-
YEARS OF PROGRAMMING yet STILL ODE IS STILL WRITTEN with memory vulnerabilities
-
Wanted to aess memory diretly anyway? We had a tool for that: It was alled “ASSEMBLY”
-
“Yes please give me NULL of something. Please give me *&* of it” - Statements dreamed up by the utterly deranged
LOOK at what Programmers have been demanding your Respet for all this time, with all of the omputers we built for them
(These are REAL programs, written by REAL Programmers):
??? ??? ???
They have played us for absolute fools
LUV ‘ODE
LUV LINUX
‘ATE WINDOWS
‘ATE ‘LOSED SOURCE
SIMPLE AS
Thank
what does this omment even say??? i ant see it
Respet earned.
Oh ome one now, an you not be suh a nit piker for one?
Took me too long to understand this, you unt.
-
Does anyone even know what Windows is written in?
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.
The actual userspace is mostly C++ and C#.
deleted by creator
True! Their embrace of Rust is certainly heartening to see.
Let’s just hope they don’t follow it up with the other two E’s in their typical playbook.
Please do go ahead and name the last open standard that Microsoft intentionally destroyed.
EEE is the fucking boogeyman on Lemmy. You just mention it’s name and a bunch of nerds shit their pants and upvote.
Atom died about 13 months ago.
Just because they’re in a relative lull in the desktop space doesn’t mean they’ve stopped.
There may be good examples out there, but I’d argue Atom isn’t one of them. VS Code was clearly intended to be a spiritual successor with MS branding IMO, it is a fork of Atom, and it is equally open source (MIT license).
Atom usage dropped off dramatically in favour of VS Code or the fully open source VS Codium, there’s no point in Github writing it’s own code editor when it’s hosting a much more popular, more powerful, and equally open source editor in one of its repos.
Github had been funding development of Atom until MS bought them, put Atom on maintenance mode for 4 years, then killed it.
Unless I’m missing something, the most recent example there is from 2002 which, to my own horror, was more than 20 years ago.
2002?
I did upvote… but my pants are pristine
And basically the entirety of dotnet 6 forward is spans. It’s all spans. All the way down.
CSPAN is so boring
witchcraft
Makes sense
C or C++ usually
yeah but which craft?
Well, you know those claims that Java runs on 18 trillion devices? How do you think they got there, hmmmmm?
deleted by creator
deleted by creator
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.
What you’re describing sounds like Python. Not really C’s strong suit.
If you haven’t checked it out yet, you certainly should!
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.
I’m not suggesting replacing the small programs with one mega Python script, I meant that even C is not a good language for that either.
If you’re chaining a bunch of stuff together through your shell environment anyway, you’re not using the low level benefits of C, so you’re just punishing yourself with having to implement everything by hand every time! Python is amazing because the syntax is clear and readable and the standard library has nearly everything you’d need if you’re not building a large application.
However since most of these things are going to be one-liners then yeah you may want to just put them in one script!
That sounds a lot more like functional programming languages / frameworks
Let’s rewrite Linux kernel in Python
Nobody’s built a supercomputer powerful enough to run a python version of even Linux Lite Edition.
Redstone it is, then.
I mean, someone made a barebones Linux work in scratch
Like… Kernel written in scratch?
Yeah, it uses Ed as it’s text editor
Fun fact!
The Asahi Linux drivers for the Apple M1 GPU were originally written in Python: https://asahilinux.org/2022/11/tales-of-the-m1-gpu/
GPU drivers in Python?!
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
It has already been translated into rust. Python wasn’t ever intended to be used in the “real” driver, but I thought it was a fun anecdote none the less.
No in JavaScript
The prophets have foretold it: https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript
Yes and let us build the environment with conda, it’s going to be a fun time!
Just use brainfuck for everything. The entry barrier for the programming industry needs to be higher anyway.
Is brainfuck efficient ?
Can be compressed very efficiently. I do dread the thought of writing a driver in brainfuck.
Can be compressed very efficiently.
Which basically means: “You have to write more code than actually needed”. It’s more a con than a pro in my eyes.
Hot take: As a VM with only eight instructions, it’s very easy to code and securely sandbox. Maybe BF has utility as a compilation target?
Why specifically a driver ?
Hardware is complex and mysterious enough without added complexity of an esoteric language.
For the programmer? Very no.
For saving space if run via interperter? No.
For running compiled for conventional CPUs? No.
Compared to CISC instruction sets? Absolutely no.
BF might be highly efficient if crunched down to a bit-packed representation (3 bits per instruction) and run on an FPGA that understands it.
For demonstrating to CS freshmen that Turing Completeness isn’t that remarkable of a language feature: very highly efficient.
But what if I want a union struct to quickly interpret floats as ints and vice versa! I need my C hacks!
You can’t, C have strict aliasing.
… Which compilers don’t consistently enforce, much like most undefined behavior in C.
How to enforce undefined behavior?
By refusing to compile any code that has undefined behavior. This is what rust’s compiler does, and is simply not possible for a C compiler to do.
To put it another way:
Strict aliasing is an invariant that C compilers assume you as a developer will not violate, and use that assumption to make optimization choices that, if you as the developer have failed to follow the strict aliasing rules, could lead to undefined behavior. So it’s a variant that the compiler expects, but doesn’t enforce at compile time.
I guess it is possible to just disable all such optimizations to get a C compiler that doesn’t create UB just because strict aliasing rules were broken, but there are still many ways that you can trigger UB in C, while safe rust that compiles successfully theoretically has no UB at all.
Strict aliasing exists not for optimization, but for type alignment. You may need more space on stack to save uint32_t than uint8_t[5] because former has 32-bit alignment.
Either way, this is a rule that you as a human are required to follow, and if you fail the compiler is allowed to do anything, including killing your cat.
It’s not a rule that the compiler enforces by failing to build code with undefined behavior.
That is a fundamental, and extremely important, difference between C and rust.
Also, C compilers do make optimization decisions by assuming that you as a human programmer have followed these strict aliasing rules.
https://gist.github.com/shafik/848ae25ee209f698763cffee272a58f8
Has a few examples where code runs “properly” without optimizations but “improperly” with optimizations.
I put “improperly” in quotes because the C spec says that a compiler can do whatever it wants if you as a human invoke undefined behavior. Safe rust does not have undefined behavior, because if you write code which would invoke UB, rustc will refuse to build it.
Compiler knows what is undefined behaviour better than all lemmy experts
It’s actually nonstandard. Use memcpy
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.
Imagine having anyone tell you how to access your memory.
Computers are so fast now, we should just write everything in BASIC anyway
Welcome to the world of JavaScript
Python laughing nervously: “haha yeah… we shouldn’t write in C, amirite guys?”
Yesterday I tried using an honest-to-god pointer pointer pointer, and I think the compiler refused on moral grounds.
Ah, a three star programmer.
I think Linux is even written in C
And Linux was never meant to access memory directly. Boom. Roasted.
Still not sure if you’re high or trolling.
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.
Of course there is, it’s Rust
/s
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 first version of sudo rewrite in Rust has been released last year: https://www.memorysafety.org/blog/sudo-first-stable-release/
C is meant for embedded stuff. #changemymind
That article is incomplete. Nowhere do I see JavaScript listed.
😂
node-os is a full operating system built on top of the linux kernel
It seems the cancer has metastasized. First to the backend, now to the entire operating system.
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.
There are actual use cases where direct memory access and pointer magic can be very efficient or almost necessary. We work a lot with large images and basically always the first steps are some pointer operations.
What kind of pointer operations?
It’s required for drivers too.
Every operating system running on bare metal needs access to the hardware. And if not on bare metal, it needs access to the virtual hardware.
Exactly for that a memory safe language would avoid so many security vulnerabilities.
Because RAM is so cheap, right?
I have used both C and Rust for embedded. Rust is significantly more enjoyable. https://embassy.dev/
C is good for nothing.
Even for small 4/8 bit soc systems?
I had the idea that C was the go-to language for that.
There’s Assembly for those
Are those still in use? With how cheap modern MCUs got, it kinda seems like it often makes more sense to get smth a bit more powerful and get the benefits of overall easier and faster development. May be wrong here, tho – it’s not like I compared numbers or something
Addit: I mean, 8 bit may easily still be a bit cheaper, yet corps will likely spend more than the difference in price paying devs
It probably won’t do anything less than 32bit, so that’s at least one thing C is good for.
@excitingburp @NocturnalMorning “C is good for nothing because I don’t enjoy it” yea that’s some big brain logic right there