Actual code from our code base: /** * Query device information. * \param arg argument * \param res result * \return error code int queryDev(void* arg, void* res);
Why do boomer C programmers do this? What the fuck does this function expect as input and output? There's no type information what so ever, and no hint from the argument names what the valid types might be either.
When I asked the developer responsible for it, he said he just copy-pasted the format from other query functions... I asked the architect who has been here for 10 years why all query functions were in this format, and he said that "it is a way to be generic and future proof".
Is this really what's considered "generic programming" in C? I fucking hate this boomer language and the people working with it.
Forgot the closing */, but yeah, you get the point Jow Forums.
Cameron Ross
It's so they can't be replaced by Pajeets.
Caleb Lewis
>Is this really what's considered "generic programming" in C? Yes
Evan Wright
What’s wrong with this code? I don't get it?
Mason Myers
I see nothing wrong with this. Possibly a little more doc in the comments to describe the argument a bit more, but it's overall fine
Thomas Nelson
how retarded do you have to be, as not to understand this perfectly usable code.
Owen Young
based and boomerpilled
Cooper Powell
It's literally what people are taught. You need to write documentation for everything, to the point you don't even stop and think what you're documenting.
>is this generics in C yes, user. void * is the closest you have to a generic. boomer language.
Christian Barnes
It's not the documentation I care about (although it in this case says absolutely nothing of value), but rather the lack of indication of what types res and arg might be. Ideally, I should understand what a function does just by looking at its signature, but here I had to go through the implementation to understand what they were supposed to be.
Nathaniel Powell
I mean, even in dynamically typed languages people use argument names to indicate what it expects.
Alexander Watson
yeah this is bad C, a decent programmer would at least typedef the outputs
Colton Long
>typedef the outputs Actually, in this case that wouldn't have helped. The reason these functions take void pointers is because under the hood they cast it do different query-structs and query-result-types depending on a type field that all the query-structs have in common. It's an attempt at generic programming.
In my opinion, it would have been better to have separate functions for the different types of queries and then use typedefs or full types.
Only parts of it. About 60-70% of it is BSD, LGPL or GPL.
Angel Collins
hey richard get back to work and stop sharing our repository on the internet
Adrian Baker
>Floats are automatically truncated to integer types in C anyway. Well, now I can tell that you've never actually programmed in C.
Luis Cox
Should use unions.
Nathaniel Foster
Where's that guy that wrote poems in his work code and then got called in by HR after they noticed the ones with guns and stuff
Matthew Collins
this is why IDEs exist
Logan Foster
What anime is it?
Luis Ross
Fate/whatthefuckareyoudoing
Dylan Davis
> void* >not void * disgusting
Henry Reyes
I guess that's the quality of free software then.
Agreed
Oliver Morris
... 'just copy-pasted'
ppl in i.t. jobs who are barely competent in .. pattern recognisers they look gr8 they look professional, they have all the right buzz words, cool dismissals
Logan Williams
IDEs to generate another generation of idiots
Sebastian Sullivan
he based.
Angel Price
that cat is overweight
Landon Bell
comments = 'clutter' IMO
Michael Peterson
look inside the function you lazy bitch. I'd fire you if you asked me that question
Isaac Gutierrez
nice gatekeeping. you know what you'd do in a good editor or a full on IDE to find out that typedef? you wouldn't fucking grep through header files, you'd hover it or jump to its definition and wow that took like 1 second. why do boomers hate productivity?
Robert Young
Actually, following the existing paradigm of the source rather than implementing your entirely unique and "clever" style is encouraged.
Luke Gray
If you can't tell from the function signature, your code is shit.