Skip to main content



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).

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.



it was Kant who said "never use a person as a mere means, unless it's in a negotiated kink scene in which case it's really fuckin' hot." he said this in the groundwork for the metaphysics of morals. I swear


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.

in reply to Asahi Lina (朝日リナ) // nullptr::live

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.

in reply to MeaTLoTioN

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.




Že by sa nudím nemôžem povedať. 🦆 🦆 🦆


seeking new instance?

Sensitive content

in reply to Coffee (Team CW)

seeking new instance?

Sensitive content

in reply to Bubu

seeking new instance?

Sensitive content

@Bubu


I gotta say, having my dad—previously a lifelong Republican—voting for Kamala Harris and sending me stuff like this now is so great 😂

Good job MAGA, good job.



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…

@kde@lemmy.kde.social

@KDE
This entry was edited (1 week ago)


Is there anything like a reasonably working local antispam solution for web contact forms? It appears the popular one is akismet, but that essentially means "sent the whole message to someone else", and that feels really inacceptable privacy wise.
in reply to hanno

adding some kind of captcha often works reasonably (like a silly math question, where you can have the right answer base64-encoded in a hidden field etc), at least for a time until you need to tweak it, depending a little on how much attention the bots give your service
in reply to daniel:// stenberg://

@bagder I don't understand the "where you can have the right answer base64-encoded in a hidden field" part. why would you need that? Check the answer client side?
in reply to hanno

the server end that receives the submission would check that the "user says" field contains the same number as the base64 decoded "answer" field does. Then you can generate quite flexible problems and yet verify them. But there are other ways you can do it as well.
in reply to hanno

@bagder that way you can give a different question/answer pair to every request but don't need to store server side what you asked.
in reply to zhenech

@zhenech and base64 was an example, you can encode it in crazier ways too, to up the game a little


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.

curl.se/docs/caextract.html



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

daniel.haxx.se/blog/2009/10/19…

#curl
This entry was edited (1 week ago)


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…

This entry was edited (2 weeks ago)


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.

#selbstbestimmtDigital

This entry was edited (1 week ago)


V 89% prípadov som v práci prvý, a z 29% aj pred manažérom. To sa nechválim... :02_hyper:
This entry was edited (1 week ago)


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.

in reply to Marco Zehe

what exactly is a thermal spa? I don't think I've been to 1 or seen 1
in reply to Marco Zehe

I imagine it being a place where you are wrapped in hot towels hehe


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

in reply to modulux

@modulux On tilting trains, I wrote more than a sentence: pedestrianobservations.com/202…
in reply to Alon

thanks, that was interesting reading. A bit surprised because living in Spain I'm familiar with TALGO and thought that was the sort of tilting you meant.


Šofér autobusu zlatý ty vole, čakal pokým si kúpim lístok, ibaže idem električkou. Ale aj tak... 😄 zakýval som mu.
This entry was edited (1 week ago)


Oh look, a setup video for your shiny new AOL Optimized PC. Wow ... I never even knew there was such a thing back in the day but here's the video nevertheless: youtube.com/watch?v=GLZqC3Mbj5…


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 lxer.com/module/newswire/ext_l…


Je nás o čašníka menej a moja kolegyňa si zlomila nohu cca 3 týždne tu nebude (podľa mňa nepríde dlhšie). Z mojej zmeny som vlastne na rajóne "sám" a miesto aby sme traja sme dvaja a ten druhý je buď externý alebo z druhej zmeny, to je presne to čo po sezóne chceš.



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 🥰

in reply to Marco Zehe

@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).

in reply to imdat celeste [witchzard]

Oh I understand! Sorry for my premature assumption that your wife was your daughter’s biological mother. :-) Then, it is even more interesting that you three look so alike.


Co se dá dělat, @fabia_man evidentně zklamal, protože mě z práce neodvolali, tak si jdu zkontrolovat, jestli mám všech 7 kol a hurá na Tewkesbury. Krásnou odpočinkovou sobotu a žádný strach, já to za vás dneska vytrhnu.


Ahoj chtěl bych vás informovat, že po nedávném restartu bohužel server kde je mamutovo.cz pixelfed nenajel a momentálně není dostupný. Pracuji na vyřešení problému, aby byl co nejdříve opět online.
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.
This entry was edited (1 week ago)
in reply to ronny

@ronny Ahoj, web jel už dpoledne, byl výpadek serveru. Jinak vhsky jsem zatím vypnul, nemá cenu platit něco co dobře nefunguje. Jinak ostatní služby samozřejmě fungují.
in reply to Archos

a nemohl bys to zapnout na par hodin, ze bych si jen zazalohoval posledni verzi subscribci? Protoze koukam, ze posledni zaloha je par mesicu stara :-/ budu to muset nejak zautomatizovat..


Lets try that again. If you haven't tried it yet, the Google Notebook LLM is quite interesting. It can take any notes, documents, manuals, etc., and create an AI-generated podcast-style output. For example, I ran last month's AppleVis Newsletter for September through this service. It's pretty long to listen to, but I was amazed by what it produced. :)


The National Federation of the Blind of Massachusetts is pleased to announce the availability of scholarships for the 2025-2026 academic year. Please spread the word widely!
docs.google.com/forms/d/e/1FAI…


My wife is a battery vendor at the local children's playground.
She sells C-cells by the seesaw.

reshared this



I’ve always lived on the west coast so when east coast friends told me years ago that Market Street in most cities is named for slave markets I’d be like “what?! but every town has one!” and they’d say “yep”

Anyway, this sign is 100’ from Louisville’s Market St


in reply to Adrianna Tan

that's exactly the emulsion/developer I used to use 20 years ago so this... grain... is giving me major nostalgia. Love your photos!


"I’d like to point out that the overwhelming majority of Black male voters are going to do exactly what I do: vote for Harris. Harris will receive between 85 and 90 percent of the Black male vote. I acknowledge that the difference between 85 percent and 90 percent could be the difference in Harris winning or losing a critical state or two, but I simply refuse to engage in a conversation that paints Black male support as the “problem” for Harris in this election. +
in reply to Ra'il IK

"The “problem” in this country is how the majority of white people vote. The force holding this country back is the majority of white people. The people who have turned against democracy are the majority of white people. The global force destroying the environment of this earth is the majority of white people. +
in reply to Ra'il IK

"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…




Dog has been crying shooting with pain. Breathing heavily. That dog is normaly silent. Guess who is not in a hurry to go to the vet in a few hours.



From the NDIS portal:
"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.
#XXXX
in reply to Jamie Teh

Wow! Those kinds of artificial constraints do not make any sense. It reminds me of password format terrorism imposed by many institutions...
in reply to victor tsaran

@vick21 Yeah, or real name constraints, or invalid email address constraints, or broken street address matching, or arbitrary business name constraints, or... so many other things.


When you’re queer, you’re so far out of the gender binary that instead of His & Hers you have, Poop & Anxiety socks

#LGBTQ #Socks

This entry was edited (1 week ago)


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



"We are the greatest employer, and we don't give a single fuck of what you think"


Internet CEO Matt Internet says that the Internet is not good enough for building the Internet with: reuters.com/technology/amazon-… #AWS #RTO
#aws #rto


lol weed union slipped a rickroll into the #Oregon voter’s pamphlet
This entry was edited (2 weeks ago)

reshared this