|
Ola posted:A dumb question: Isn't there huge amounts of user friendly tooling that makes C easy and safe by now? If you have the luxury of working on a brand new project in C (but, not in some other language for some weird reason) and you're very disciplined, and sufficiently experienced, you can write reasonably safe code. It's not automatic and you're almost always better off using another language where the safety checks are built-in. Even here, crusty old APIs will bite you because they often predate best practices and mangling things to make them work reasonably takes effort. Add in an actual legacy codebase and the problem gets a few orders of magnitude worse. For the hell of it I turned -Wextra on again for a code I've been working on recently and the two things that bite me are unused parameters, which I get why it warns you about them but sometimes APIs genuinely contain unneeded/reserved parameters, and a bunch of signed/unsigned integer comparisons where I'm intentionally exploiting unsigned integer promotion.
|
# ? Feb 24, 2022 15:43 |
|
|
# ? Apr 27, 2024 06:39 |
|
ExcessBLarg! posted:For the hell of it I turned -Wextra on again for a code I've been working on recently and the two things that bite me are unused parameters, which I get why it warns you about them but sometimes APIs genuinely contain unneeded/reserved parameters, and a bunch of signed/unsigned integer comparisons where I'm intentionally exploiting unsigned integer promotion. The "usual" way people deal with this if they want the unused parameters warning enabled is to #define UNUSED(x) (void)(x) and start functions with unused parameters as C++ code:
|
# ? Feb 24, 2022 16:17 |
|
The project I'm on now has an UNUSED() macro but it's being deprecated in favor of just doing (void) casts for some reason. Seems to me like keeping it easily searchable is reason enough to stick with the macro solution.
|
# ? Feb 24, 2022 16:23 |
|
Thankfully it's not a default warning with -Wall.
|
# ? Feb 24, 2022 16:41 |
|
C and C++ only complains about a parameter being unused if you give it a name. So you'll get a warning forcode:
code:
ultrafilter fucked around with this message at 16:46 on Feb 24, 2022 |
# ? Feb 24, 2022 16:43 |
|
ultrafilter posted:C and C++ only complains about a parameter being unused if you give it a name. So you'll get a warning for Doesn't work with conditional compilation (for different platforms, features, debug) unless you also put the function definition header in the #ifdef.
|
# ? Feb 24, 2022 16:53 |
|
What #ifdef?
|
# ? Feb 24, 2022 16:55 |
|
Not much, what #ifdef with you?
|
# ? Feb 24, 2022 17:01 |
|
ultrafilter posted:What #ifdef? I don’t know, what’s #ifdef with you? Edit: gently caress!
|
# ? Feb 24, 2022 17:02 |
|
ultrafilter posted:What #ifdef? code:
There's a good argument to be made that you shouldn't use ifdefs this granularly, but this type of code is all over the place. Avoiding it can also lead to tons of lovely code duplication.
|
# ? Feb 24, 2022 17:24 |
|
code:
|
# ? Feb 24, 2022 17:28 |
|
ultrafilter posted:
|
# ? Feb 24, 2022 17:32 |
|
DoomTrainPhD posted:I don’t know, what’s #ifdef with you? Shoulda put an #ifndef on your post
|
# ? Feb 24, 2022 18:01 |
|
https://twitter.com/zdimension_/status/1497004313427722240
|
# ? Feb 25, 2022 03:45 |
|
Volte posted:Now use that parameter in the body of foo, but only on Windows At that point I'd be looking at a wrapper function that can be easily inlined.
|
# ? Feb 25, 2022 05:27 |
|
ultrafilter posted:At that point I'd be looking at a wrapper function that can be easily inlined. You're gonna have to be more specific about this because the obvious way of writing such a wrapper function runs into literally the exact problem that everyone's discussing. Or do you mean you'd manually inline this function and its own (potentially complex) if-defs in every place that it's called?
|
# ? Feb 25, 2022 05:34 |
|
ultrafilter posted:C and C++ only complains about a parameter being unused if you give it a name. this behavior doesn't look standard on C (until C23), source cppreference: C code:
|
# ? Feb 25, 2022 06:42 |
|
Ola posted:A dumb question: Isn't there huge amounts of user friendly tooling that makes C easy and safe by now?
|
# ? Feb 25, 2022 13:56 |
|
C is easy and safe already, if you know what you're doing.
|
# ? Feb 25, 2022 16:56 |
|
Presto posted:C is easy and safe already, if you know what you're doing. No human knows what they are doing. Maybe things like your avatar do.
|
# ? Feb 25, 2022 18:16 |
|
Who even needs a debugger? Just write your code correctly the first time.
|
# ? Feb 25, 2022 21:30 |
|
Quebec Bagnet posted:Who even needs a debugger? Just write your code correctly the first time. My code is always correct, for certain definitions of correct
|
# ? Feb 25, 2022 21:41 |
|
My code always does exactly what I want it do. Just because it doesn’t do what you want it to sounds like your problem.
|
# ? Feb 25, 2022 21:43 |
|
nielsm posted:NaN by definition represents an unknowable value, so you have to assume that two NaN values are different. NaN (a floating ball of eyes and wings) " be not afraid... but I have looked at your code so ... be somewhat ashamed"
|
# ? Feb 25, 2022 23:12 |
|
Ola posted:A dumb question: Isn't there huge amounts of user friendly tooling that makes C easy and safe by now?
|
# ? Feb 25, 2022 23:14 |
|
Someone in this thread once described C++ as a language made of byzantine footguns. By backwards extension, C is a language made for creating byzantine footguns.
|
# ? Feb 25, 2022 23:29 |
|
Quebec Bagnet posted:Who even needs a debugger? Just write your code correctly the first time. Somebody https://twitter.com/coil780/status/1497245075977375746 The perpetrator, in case he have not deleted his twitter account now https://twitter.com/allenholub/status/1496326760719216643
|
# ? Feb 26, 2022 11:12 |
|
writing bugs in the first place? pathetic. unprofessional
|
# ? Feb 26, 2022 11:31 |
|
I love Holub, he gives such bad takes so frequently that I can't decide if a) he's a total maniac b) he likes to rile people up because he's a "software influencer" and knows that this increases engagement with his brand or c) this "you don't need testers, actually" take works well with management at the companies he consults for and never sticks around in long enough to witness the consequences of following his guidance. Probably all three I guess
|
# ? Feb 26, 2022 15:12 |
|
Itaipava posted:I love Holub, he gives such bad takes so frequently that I can't decide if a) he's a total maniac b) he likes to rile people up because he's a "software influencer" and knows that this increases engagement with his brand or c) this "you don't need testers, actually" take works well with management at the companies he consults for and never sticks around in long enough to witness the consequences of following his guidance. Management consultants exist to tell management what they want to hear. If this guy has a particular brand, they're expecting to get particular feedback. So yeah. All three sounds right.
|
# ? Feb 26, 2022 15:18 |
|
I like to read his blog posts as performance art. For this bugtracking thing he posted one where he starts with:quote:You do not need a bug tracking system. In fact, a bug tracking system is a symptom of a deeper problem—insufficient focus on quality. ...and then when a reader leaves a comment calling him out and pointing out that his wordpress install has the wrong time he replies with: Bugs for thee but not for me
|
# ? Feb 26, 2022 15:36 |
|
Dude just doesn't realize that Twitter is his bug tracker now. He can CLOSE: WONTFIX every bug if he wants, but that's still where they're getting reported.
|
# ? Feb 26, 2022 17:10 |
|
The "file a ticket and maybe we'll schedule it next quarter" approach to dealing with bugs is pretty garbage and the focus on shipping features on schedule over fixing bugs asap is a big part of why software is so awful, but even when working on small self-contained things I've accumulated a list of bugs to fix while in the process of fixing the first bug I found plenty of times.
|
# ? Feb 26, 2022 17:11 |
|
Even if you do fix every bug immediately on discovering it - which you can't - there are still a half-dozen excellent reasons that you still need to track that work.
|
# ? Feb 26, 2022 17:19 |
|
Let alone the reasons you may not bother fixing bugs.
|
# ? Feb 26, 2022 17:22 |
|
Side question, is using github as a bug tracker feasible? Im planning on eventually attemtping to get my project adopted and am wondering if a Google form or Github would be better for a "Bug Report" with a bunch of decidedly older and non tech savvy walking ID10T errors.
|
# ? Feb 26, 2022 17:41 |
|
D34THROW posted:Side question, is using github as a bug tracker feasible? Im planning on eventually attemtping to get my project adopted and am wondering if a Google form or Github would be better for a "Bug Report" with a bunch of decidedly older and non tech savvy walking ID10T errors. GitHub has an issue tracker so I'd say... use that over a Google form. If you have to go out of band (repo in GitHub, bugtracking elsewhere) it should be for something more fully featured.
|
# ? Feb 26, 2022 17:52 |
|
GitHub issues are a totally reasonable way to track bugs, but you'll probably still want some other way for non-technical end users to ask questions and report problems.
|
# ? Feb 26, 2022 18:06 |
|
Yeah depending on audience, I wouldn't tell them they should create their own issues or give them anything other than read-only access to your bugtracker. If you think that would result in pure garbage they should chat with you, you can tell them what issue to watch and its priority if it's a real problem.
|
# ? Feb 26, 2022 18:21 |
|
|
# ? Apr 27, 2024 06:39 |
|
Oh, it would be reporting only. Im the sole developer of a pet project to improve company wide workflow, itself an outgrowth of a mountain of VBA I wrote to do the same in excel and months of work I spent on an Access app a few years back. Nobody not at least as competent in Python as i am would touch my code, which excludes probably 99% of the company. Reports only, mitts off my loving code EDIT: i also considered a gmail for the app to send out reset emails and such, perhaps another one for bug reports or the same one and I do it myself on Github. Not that I expect bugs. It's fairly simple stuff on the backend and im testing wacky edge cases as I go along, but poo poo happens.
|
# ? Feb 26, 2022 18:53 |