@calcopiritus@lemmy.world
member since 3 Sep 2023 00:56
comments
- on OpenAI hacked Medicare portal, Prime Minister Anthony Albanese says in c/technology@lemmy.world · 14h ago
-
on can somebody confirm this pls? in c/programmer_humor@programming.dev · 2d ago
Can confirm. I have to do this all the time. Some coworkers just delete it, and I have to explain the situation every time when they see in the git blame that I put that semicolon there.
As someone pointed out in another comment, in switch statements you should just start a new scope with
{}. But in actual labels it’s just better to put a load-bearing semicolon. You don’t need to put it in another line though, I just put them like this:int main() { int *a = malloc(sizeof(*a)); if (init_a(a) <= 0) { goto err; } do_something(a); err:; int ret = 0; if (a == NULL) { ret = -1; } free(a); return ret; }
-
on ‘Doom Loop’: OpenAI and Microsoft Admits LLMs Are Destroying the Web and Built on Theft in c/technology@lemmy.world · 6d ago
Anyone with 2 braincells saw this from day 1. Unfortunately the timeline lined up with USAians electing a president with less than 1 braincell. So there was no one to stop them when it was time to stop them.
They destroyed the web forever for the entire world, but owned the libs for a couple years, so it’s worth it I guess.
-
on Peer reviewing is torture now in c/programmer_humor@programming.dev · 12 Sep 2026
He knows best what’s best for him. If he’s explicitly paid extra to be on call 24/7, and he’s happy with that extra. Let him be om-call 24/7.
There are situations and jobs where 24/7 availability is needed. Someone has to do it. And if that someone believes he’s getting enough of a compensation for it, there’s nothing wrong with it.
-
on Made this after someone noticed her face looked like PirateSoftware in c/programmer_humor@programming.dev · 10 Sep 2026
Yeah, my bad. Long time I don’t use java and miss remembered. Apparently proper java enums exist since 2004.
-
on Made this after someone noticed her face looked like PirateSoftware in c/programmer_humor@programming.dev · 10 Sep 2026
That’s just someone that doesn’t know why people say things, so just made it up.
Enums outside of rust are indeed bad (I would correct it to enums in every language I know that is not rust, since maybe some other do the same thing as rust). But it’s not because the tagged union thing.
The problem of enums in other languages is that they do not make for a distinct type. They are just integers in a name. Or at least that is the case for C and Java enums. Python and JavaScript do not even have enums, which is even worse.
When enums are just integers, you don’t know if a variable of the type of the enum is actually one of the variants of the enum. If you assume that, you can easily get into undefined behavior/crash territory quite fast.
When making a library in C, for example, if one of your functions has an enum as a parameter, one of the first things you have to do is check if that parameter is actually in the range of the enum. Since you don’t control the caller to your function. These checks don’t belong in code at runtime, they belong to compile time, as you’re just validating the type of a variable.
In rust, switch/match statements need to cover every single enum variant (of course, you can also have default paths to not cover every case) your code just won’t compile if you don’t. Which means that when you add a new variant to an old enum, you don’t have to go hunting every match statement to see if it affects your new change. That is a tedious and error-prone task if done manually, while it is pretty simple for the compiler.
Of course, now that these differences are established, the tagged union thing comes in and makes rust ones better. The reason other language enums are bad is because they’re named integers, the reason rust’s are good is because they are tagged unions, completing the algebraic type system.
-
on World's first GPS-free quantum navigation trial succeeds at sea in c/technology@lemmy.world · 30 Aug 2026
Gravitational field. There’s no way you could achieve this with the magnetic field.
Why do they express disappointment?
What they should express is criminal charges and an extradition request.