Destructuring in C
@Pankak Lmao, ofc it is, it's UB; I'm reusing the values that were still left on the stack to automatically fill
y, but that is exactly how a destructuring operation would be compiled, just push some values to the stack, and use those as the variables, so at least it's performant. (btw, even -O1 will make this fail)
Btw, you probably heard that C# has destructuring, not C.
@xxpertHacker wait only one way I could kinda think of it is with a function. You provide with the struct you want to destructure and the number of members, and using your ud behavior destructure it. Maybe also provide it with a callback with the function but this runs into the problem of the function only being able to destructure one struct and not being able to have other arguments (unless we use variadic args and keep the destructured struct last in the params, but still, limitations). Or if you're able to do something like this
UNLESS that works which would still limit it to 1 destructured struct but whatever
Probably easier to just do
@xxpertHacker no you were dissing macros, theres nothing wrong with the preprocessor. I agree macros are evil beings which shall not be touched, but its kind of like that one neighbor who snipes dogs when they poop in his yard and is a pure evil life form which you shall never be associated with, but eventually you're gonna have to ask him to borrow his sniper to assassinate your ex girlfriend
@Pankak Lmao, just don't get the gf and you're safe all around.
Better yet, move out of the neighborhood, so you don't have to deal with either, your gf, or the evil neighbor. (equivalent to not using C at all)
There are legitimate uses for the preprocessor: handling different versions of the language and checking compiler flags.
Btw, what's so bad about sniping dogs?
Sniping dogs is animal abuse, use something less painful like a landmine, bomb, 10 petawatt laser, or use concentrated plutonium vapor to provide the creature with a less agonizing death, it's a win-win
You have to offset the price with the value, a bullet isn't too expensive, but getting an explosive is expensive.
It also takes time for the black-market smuggler to ship a landmine.
In contrast, the dog isn't worth much, so the dog doesn't pay for itself.
Also, what if I want to eat the animal afterward? Its corpse needs to stay intact.
tell me you haven't lost braincells reading his answers,
I've lost just about all of 'em reading Ryan's answers, most are not even remotely helpful.
The only thing that's worse than the answer, is the fact that people mark them as "correct."
Some of those suggestions aren't even languages.
I sometimes question why I'm even on a website full of 11 year olds
I'm usually on GitHub, or ... anywhere else, I just use Repl to run code. (a desktop PC would be 10x better)
That, and I check out whenever someone pings me for C/C++.