The reason I hate C so much has very little to do with its unsafety. Sure, that’s a problem, but the thing I really hate is how bad it is for building abstractions. Even simple things like linked lists or dictionaries require exposing data-structure implementation details in ways that make refactoring hard.
If I write C++ (or almost any higher-level language), I can start with a linked list and then decide that I know the maximum size and want better cache usage and switch to a flat data structure. Iterations stay the same and I change little code. Try building something in C where data structures are exposed with a uniform iteration API or indexed addressing depending on their use.
This extends further to trivial things like object destruction. If you look at Linux or BSD kernel code, you’ll often see a pattern of gotos for cleanup, where each step that can fail jumps to a corresponding error path that frees everything that’s been allocated so far. This exists because a lack of abstractions. In C++ or Rust, RAII would call the destructors on the objects as they go out of scope, so your error handling paths are just return failure and the cleanup happens automatically. You don’t need to write it every driver, the classes that own different resources know how to deallocated themselves.
When I write the same thing in C and C++, I end up writing more code in C, but when I then write another instance of similar code in C, I have to copy and paste a load of things because there is no way to properly abstract them out in C. This is the kind of thing that can cause memory-safety errors (because there aren’t abstractions that enforce properties that the programmer knows) but it also leads to a load of logic bugs.
I have no idea why anyone would choose C today. C++ can target the same ABI and generate identical binaries from less (and more reusable) source code. Rust can enforce more properties at compile time automatically. Garbage-collected languages can let you write complex cyclic data structures and correctly manage them (my current favourite approach for a lot of things is to write some core things in C++ and use Sol3 to expose them into Lua for all of the business logic).
On the Zig vs. Rust debate, people like to focus on memory safety, but Rust's RAII is just as important to writing clean, maintainable code.
There is something truly magical about seeing my GPU driver cleaning up dozens of nested GPU and host objects when the GPU job completes. Always exactly then, never too early, never too late, never leaking anything. That's all thanks to RAII and automatic Drop calls.
`defer foo.deinit()` really doesn't cut it. You have to explicitly write it, and it only works if all code paths free the object at the end. `errdefer` is just a special case, and then the only way to know if you forgot it is by testing with a leak checker. And then the deinit function has to manually deinit all child objects.
All this stuff is just done automatically in Rust. Most of my types don't even implement Drop, or only do something trivial there, because the compiler recursively dropping objects is 99% of the work.
It's *knowing* the compiler is on your side and taking care of all this that makes it magical. If you have to write out the code by yourself, that's more work, and a huge chance for bugs. The compiler is doing some very complex tracking to figure out what to drop when and where. You'd have to do that all in your head correctly without its help.
if you're putting all your trust in the compiler to keep you safe, wouldn't that lead to being taken down the path of bad habits? Surely it's better to learn how to keep your own code safe and not depend all your trust into a compiler?
The take away, for me, is this; if you can't write clean code and need something else to do it for you, learn. Learning makes you better, and being better makes you want to learn more.
That argument is a fallacy, disproven time and time again by C. Not even the most experienced C coders in the world can write correct, bug-free C.
Pretty much everyone who seriously tries Rust understands just how game changing it is in this regard. In fact, not only does Rust do a lot of things for you, it also encourages you to structure the code in a more logical and maintainable and understandable way, and people who learn Rust often report they also become better C coders as a result, which is the exact opposite of what you suggest.
Software is tens of thousands of times more complex than when languages like C were developed, and we *need* assistance from tooling and compilers to help manage that complexity.
KUnifiedPush: KDE's efficient way of delivering notifications to your apps
KUnifiedPush, KDE's client library for the UnifiedPush protocol, has reached version 1.0.0. KUnifiedPush provides a way to deliver notifications instantly to multiple apps on your devices even if the apps are not running.
Ideal for social media, weather and instant messaging apps, it will also contribute to improving the battery life on your mobile devices.
blogs.kde.org/2024/10/19/kunif…
KUnifiedPush 1.0.0 is out!
KUnifiedPush provides push notifications for KDE applications. Push notifications are a mechanism to support applications that occasionally need to receive some kind of information from their server-side part, and where receiving in a timely manner m…KUnifiedPush 1.0.0 is out!
On this day in 2006, 18 years ago, I started offering the Mozilla CA cert bundle as a PEM file for everyone to use. The service is still running, uninterrupted, ever since.
Because I think we need it.
Today is **fifteen years** since I posted about the "null-prefix domino" - common problems in TLS server certificate verification functions in many projects, including #curl
Oyes, ¿recordáis cuando medio internet daba la matraca sobre como "estar sentado es el nuevo fumar" y como nos vendían los "standing decks" como la gran revolución en el mundo de la salud laboral y casi una obligación si no querías morir de un infarto en tu silla de trabajo?
Pues acaba de salir un estudio al respecto y adivinad qué: no solo no reducen la mortalidad sino que aumentan el riesgo de varices y trombosis venosa profunda.
👉 academic.oup.com/ije/article/5…
Device-measured stationary behaviour and cardiovascular and orthostatic circulatory disease incidence
AbstractBackground. Previous studies have indicated that standing may be beneficially associated with surrogate metabolic markers, whereas more time spentAhmadi, Matthew N (Oxford University Press)
Eine Gruppe junger Leute am Nebentisch.
Es gibt die Frage in die Runde, ob den anderen bei #Instagram heute auch #Werbung über ein Produkt angeboten wurde, über das sie gestern sprachen.
Bestätigung von anderen und für einen Moment macht sich #Unbehagen breit...dann Kichern und Lachen ... man zeigt sich gegenseitig die Smartwatches, es fallen Wörter wie Apple, Garmin und WhatsApp.
Das Leben geht weiter.
Good morning from Germany in the Central European timezone! Yesterday, I spent an afternoon at a thermal spa, spending time with a friend and having some very good relaxing time and fantastic conversations. He is 26, and one example why I get along best with younger and mostly queer people.
I was so relaxed, that I fell asleep at around 8 and, with only one brief bathroom break, slept for over nine hours, which is rare for me. Must say I feel very well rested this morning.
What are some examples of things you used to think but changed your mind on?
In my case, in public transport and urbanism:
* I used to support some tech I now think is a dead-end (large-diameter TBMs, active tilt)
* I used to think local community empowerment and consensus were a good way to run cities
* I thought Japan did both clearly better than Europe
Tilting Trains and Technological Dead-Ends
The history of tilting trains is on my mind, because it’s easy to take a technological advance and declare it a solution to a problem without first producing it at scale. I know that 10 years…Pedestrian Observations
AOL Optimized PC Instructional Video
This is an instructional video that came with the AOL Optimized PC, in both English and Spanish.YouTube
Loving this new era of indie blogs splitting off from their corpo bastards and forming their own coops:
404media.co/
aftermath.site/
defector.com/
Even more listed at the end of Hearing Things’ about page:
hearingthings.co/about/
Google's Extension-Killing Manifest V3 Rollout Is Stepping Up, and It's Time to Jump Ship
Why stick with Chrome when there are so many other options?Gavin Phillips (MakeUseOf)
Speaking of #MyAdoredDaughter this morning... I don't know if I ever posted this photo.
This is ... my daughter? This is how she looks like, exactly - a beautiful, young person with long legs, and wonderful hair. And she keeps telling me "OMG, we look so alike, we could be twins..."
#Trans #Enby #NonBinary #TransJoy #EnbyJoy #NonBinaryJoy #Selfie
...
... but no, this is not a photo of her, this is a selfie of me reflected in a window. When I saw myself reflected in that window, I had to take a selfie and send it to her and she was absolutely amazed at how similar we look now, really, like twins, everything, the form, hair, posture, arms, legs, ... only her face is slightly different (and way younger, obviously 🥰
@Marco TBH, she resembles my wife more than her mother (my wife isn't her mom), but she looks more or less exactly like me. So the photo above could really be me or her, if I didn't tell you who that person is on the photo and you'd see us next to each other, you couldn't tell who that was.
But, and that's the fun part, whenever she is visiting us and we three, her, my wife and me, go out for a walk, people are 100% sure she is our daughter, because she has nearly nothing from her biological mom, but some really interesting similarities with my wife.
In my own case, I have half-half, i.e. about half of me resembles my father, and half my biological mother (as far as I can remember, and I have one single photo of her).
Omlouváme se za způsobené nepříjemnosti a děkuji za vaši trpělivost. Jakmile bude server opět dostupný, budu vás informovat.
docs.google.com/forms/d/e/1FAI…
National Federation of the Blind of Massachusetts Scholarship Application
The National Federation of the Blind of Massachusetts is pleased to announce the availability of scholarships for the 2025-2026 academic year. Up to four scholarships will be awarded: one in the amount of $3,000.00, 2 in the amount of $1,500.Google Docs
Three photos around SF Chinatown in Kodak Tri-X
(Leica M3, 50mm Summilux, dev in Xtol stock @ 7:45, scanned on Nikon Coolscan 8000ED)
#BelieveInFilm #Photography #FilmPhotography #BlackandWhite #Kodak #Leica #SanFrancisco #BayArea #California #Chinatown #Chinese
"If you are in the white liberal minority and you want to freak out about something, freak out about your cousins and grandmothers and colleagues who are about to cast a ballot for an unhinged authoritarian. Go deal with the white people in your life instead of placing the burden on Black folks to save this country from the majority of white folks yet again."
— Black Men Will Vote for Harris—White Men Are the Problem.
thenation.com/article/politics…
Black Men Will Vote for Harris—White Men Are the Problem | The Nation
Why is the media talking so much about the fraction of Black men who might go MAGA when more than 60 percent of white men will vote for Trump?The Nation
"The document with the file name xxx - Your xxx receipt [#xxxx-xxxx].pdf cannot be uploaded. Please upload a document with the file name which contains the following characters only a-z A-Z 0-9 # + , @ ^ . _ & -.']"
What the actual Zarq. Why should you care about the file name? You asked for a name for the file in a separate text box, so the file name on my local file system is literally irrelevant. Incompetence seriously annoys me.
Did you know the government is directly asking you if you want them to regulate SUV so they kill less people, especially children?
"We seek to address the many U.S. variants and other models built upon uniquely American platforms.
This includes essentially the entire pickup truck and large SUV segments."
Take control back from car makers and pro-SUV by giving your feedback here⬇️ (and don't hesitate to retoot, thank you!).
regulations.gov/document/NHTSA…
#car #suv #regulation #carculture #regulation #pedestrian #children #walkability
reshared this
reshared this
Matt Campbell
in reply to david_chisnall • • •> I have no idea why anyone would choose C today.
Some Unix fans seem to really hate C++. One such person, Drew DeVault, once told me this in an email:
> C's simplicity limits you in all the best ways. It forces you to keep your code simple, readable, and maintainable by someone other than yourself.
>
> sr.ht/~sircmpwn/cstyle
>
> Program conservatively.
That was a few years ago, but the design of his newer Hare language suggests he still feels that way.
I chose Rust.
cstyle: C style guide
sr.ht