Earlier quoted context omitted.
I also wonder this. "Unused parameter in function" is one of the most basic warning/linting checks. I'd be interested in finding out how this managed to reach release.
Both GCC and clang warn about unused parameters, but only when you run them with -Wextra.
Everybody makes mistakes when writing comparison functions
21–30 of 63 posts
Re: Everybody makes mistakes when writing comparison functions
#22Earlier quoted context omitted.
I also wonder this. "Unused parameter in function" is one of the most basic warning/linting checks. I'd be interested in finding out how this managed to reach release.
Both GCC and clang warn about unused parameters, but only when you run them with -Wextra.
https://xkcd.com/1172/ in action
Re: Everybody makes mistakes when writing comparison functions
#23Earlier quoted context omitted.
Both GCC and clang warn about unused parameters, but only when you run them with -Wextra.
As lots of us know from experience, it's very ver hard to get an in-production project into a warning free state with warnings at maximum and warnings as errors. I'm currently working on a new project this year and it has been such a joy to have near max compiler warnings as errors with multiple compilers (and clang tidy and clang format) right from the start.
Re: Everybody makes mistakes when writing comparison functions
#24Everybody makes mistakes writing any kind of function.
I don't know where this started (more, when it got popular) but it's such a cop out and lazy argument to anything safety-related.
It adds nothing to the discussion and provides no insight or substance, yet people parrot it often, especially around "language lawyer"-type HN articles.
Moreover, it's wrong. Not every function has a bug. Yes, there are ways to prove this. No, not every function needs to protect against the computer being struck by lightning, or any other fault, in every case. It's such a weird and wrong argument and it's always said with such confidence.
Re: Everybody makes mistakes when writing comparison functions
#25Re: Everybody makes mistakes when writing comparison functions
#26Everybody makes mistakes writing any kind of function.
God I'm so tired of this take. "All code has bugs." "Everyone writes shitty code, some just make it less shitty." ad nauseum. I don't know where this started (more, when it got popular) but it's such a cop out and lazy argument to anything safety-related. It adds nothing to the discussion and provides no insight or substance, yet people parrot it often, especially around "language lawyer"-type HN articles. Moreover,…
Re: Everybody makes mistakes when writing comparison functions
#27Earlier quoted context omitted.
> Why is a separate static analyzer necessary for this Because this is a nail this co-founder of PVS-Studio saw while holding the hammer he wants to sell. By the way, it seems to me this error does not have much to do with comparison functions, it is a mistake that can be made in many kinds of functions. Unused parameters are warned against in C (hence all the UNUSED macro hacks) and no static analyzers are going to…
Last time OpenSSL was in the news for a bug that should generate a warning I took a cursory look at some of the code, it was stuffed with stuff that would generate similar warnings. So at that time I concluded that going through all the warnings would be a pretty big job, and that is likely why nobody did so. On the more speculative front, it might be that some maintainer is against taking whitespace patches, that wo…
Re: Everybody makes mistakes when writing comparison functions
#28Earlier quoted context omitted.
Both GCC and clang warn about unused parameters, but only when you run them with -Wextra.
As lots of us know from experience, it's very ver hard to get an in-production project into a warning free state with warnings at maximum and warnings as errors. I'm currently working on a new project this year and it has been such a joy to have near max compiler warnings as errors with multiple compilers (and clang tidy and clang format) right from the start.
True, especially for older projects which never cared about warnings to begin with. Still when I encounter one I might try it anyway, gradually if possible, to see what comes out. Not just because it is indeed just joy to have no warnings, but also because more often than not some of those warnings actually tell you there are bugs. Or for example (just had this last week) because there are projects which compile with 10k+ warnings which mean that even if you just compile a single file, it is way to hard to tell whether your new code just introduced a new warning and if so which one it is.
Re: Everybody makes mistakes when writing comparison functions
#29Everybody makes mistakes writing any kind of function.
God I'm so tired of this take. "All code has bugs." "Everyone writes shitty code, some just make it less shitty." ad nauseum. I don't know where this started (more, when it got popular) but it's such a cop out and lazy argument to anything safety-related. It adds nothing to the discussion and provides no insight or substance, yet people parrot it often, especially around "language lawyer"-type HN articles. Moreover,…
This doesn't excuse writing buggy code, same as you should always handle a gun with care, but it promotes good behaviour around it.
Re: Everybody makes mistakes when writing comparison functions
#30Earlier quoted context omitted.
Last time OpenSSL was in the news for a bug that should generate a warning I took a cursory look at some of the code, it was stuffed with stuff that would generate similar warnings. So at that time I concluded that going through all the warnings would be a pretty big job, and that is likely why nobody did so. On the more speculative front, it might be that some maintainer is against taking whitespace patches, that wo…
“The code quality is excellent” is either the author hedging pissing people off who are fans of OpenSSL or their analyzer doesn’t spot a lot of issues and thus they conclude it’s excellent for those reasons.
I have not looked yet at the new version, which has a very large number of changes, but it is quite possible that the author is right and that the rewritten code is very good.