Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Spatial posted:

This is so terrible, it's like human clippy giving C++ advice

Does anybody remember the username of that weirdo who would open issues in GitHub C repos demanding that they fix some usually harmless warning or lint and then proceed to completely ignore responses or insist in the most obtuse manner, to the degree that some goons thought it was a bot?

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015

nielsm posted:

Personally I'd prefer this written as (std::signbit(lhs) != std::signbit(rhs)), to make the expression explicitly read as "the left and right hand sides have different sign".

TIL about signbit, stealing this now.

SirViver
Oct 22, 2008
I know basically nothing about modern C++ / template shenanigans and haven't worked with it since school (so ah... 20 years ago?), so I'm not even sure if this is introducing some subtle error/UDB, but one thing I still find a tiny bit confusing is:
C++ code:
// We want to ensure that +/- 0 is always represented as positive zero
if ( lhs == positive_zero ) { lhs = positive_zero; }
if ( rhs == positive_zero ) { rhs = positive_zero; }
Wouldn't this read slightly clearer like so:
C++ code:
// We want to ensure that +/- 0 is always represented as positive zero
if ( lhs == 0 ) { lhs = positive_zero; }
if ( rhs == 0 ) { rhs = positive_zero; }
That way you'd at least kinda intuit that in the comparison you're equating with +/- 0 instead of the name positive_zero leading you astray yet again. Sure, at least to my understanding 0 and positive_zero is exactly the same here and it's just lhs/rhs that could actually contain a -0, but having the comparand actually be different to what you assign is what would make the whole expression clearer.

Unclear:
if ( x == SOMETHING ) x = SOMETHING

Clear:
if ( x == SOMETHING ) x = ANOTHERTHING (even though SOMETHING and ANOTHERTHING are the same internally)


I'm also assuming something like this is not possible?
C++ code:
// We want to ensure that +/- 0 is always represented as positive zero
if ( lhs == -0 ) { lhs = 0; }
if ( rhs == -0 ) { rhs = 0; }
Or if it needs to be the "FP" type for template reasons, substitute the positive_zero in again above for the assignments. Or make another constexpr named any_zero for the comparand. Just whatever it takes to document that the == is a fuzzy comparison here.

Brain Candy
May 18, 2006

SirViver posted:

Just whatever it takes to document that the == is a fuzzy comparison here.

I feel the c++ overtaking me

"if you're in a templated function in c++ talking about ufps, you should know that == is a fuzzy comparison for fp types"

aaaaaah

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
Ah that's cool a code review of a nice hairy fp detail knowing function. Now to take a biiiig ulp of this soda and read it,

Brain Candy
May 18, 2006

adding a comment that 0.0 == -0.0 is the kind of borderline comment where in i understand why people ask for them, but after they've heard they explaination they don't need the comment

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
Also if you wanted to go nuts with it you could jump up to c++20 and put that is_iec559 as a requires:

C++ code:
template<typename FP>
requires std::is_iec559<FP>
uint64_t ulpDistance(FP lhs, FP rhs) {
...
so that's kinda cool. Pretty much just a difference in taste w/r/t a static_assert I guess. Also half the poo poo in c++20 straight up doesn't work in clang 12 or libc++ 12 much less previous versions lol!!!

repiv
Aug 13, 2009

NihilCredo posted:

Does anybody remember the username of that weirdo who would open issues in GitHub C repos demanding that they fix some usually harmless warning or lint and then proceed to completely ignore responses or insist in the most obtuse manner, to the degree that some goons thought it was a bot?

Markus Elfring?

Winter Stormer
Oct 17, 2012

NihilCredo posted:

Does anybody remember the username of that weirdo who would open issues in GitHub C repos demanding that they fix some usually harmless warning or lint and then proceed to completely ignore responses or insist in the most obtuse manner, to the degree that some goons thought it was a bot?

Markus Elfring. He, or his bot, is still at it

Tei
Feb 19, 2011
Probation
Can't post for 5 days!

repiv posted:

Markus Elfring?

So whats everyone here opinion of SonarCube ?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

repiv posted:

Markus Elfring?

Winter Stormer posted:

Markus Elfring. He, or his bot, is still at it

Thanks!

toiletbrush
May 17, 2010
i just did a google search for this guy and read some of his conversations on mailings lists etc and i can see words and phrases and what look like sentences but i can't extract any meaning from anything he says

quote:

Evolutions and software refactorings are just happening.
Can we continue to clarify the concrete programming items
also for a more constructive review of this patch variant?
what on earth

Spatial
Nov 15, 2007

pro grammer

Macichne Leainig
Jul 26, 2012

by VG
This morning a developer on my offshore team alerted me to a new issue that just came up with a third-party dependency we're using.

The actual issue: they removed package-lock.json from source control, and now they don't understand why different versions of things are working differently.

:thunk:

At least it's git and that's an easy restoration!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Tei posted:

So whats everyone here opinion of SonarCube ?

The only experience I've had is someone opening an issue on a library I maintain (might have been some other static analysis tool, don't remember) with "a tool flagged a problem in line X", and I looked at line X and said "I believe you but I don't understand where the problem is, can you tell me anything more?" and they never replied.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Carbon dioxide posted:

Can we list the crimes of Eich?

- Said masks and lockdowns don't work and that Fauci "lies a lot"
- Invented a cryptocurrency
- Is against same-sex marriage
- Invented Javascript

I'm not sure which of these is the worst.

Can we just never mention Eich, if they're a trash human?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Tei posted:

So whats everyone here opinion of SonarCube ?

i can never take it seriously because of the name (and because it's spelled with a 'q'). i need to constantly remind myself that it's not a late-90s mp3 player with a neon green alien spaceship theme

Tei
Feb 19, 2011
Probation
Can't post for 5 days!

pokeyman posted:

The only experience I've had is someone opening an issue on a library I maintain (might have been some other static analysis tool, don't remember) with "a tool flagged a problem in line X", and I looked at line X and said "I believe you but I don't understand where the problem is, can you tell me anything more?" and they never replied.

90% of what these tools produce is false positives. They have hardcoded arbitrary rules that use everywhere. Some of these rules have good intention, but the tools are not subtle enough to ignore files and uses that a programmer would ignore.

Some industries have adopted these tools as a way to measure code quality, so now some programmers live by the sword that is these tools.

I have started working on two codebases where is a requirement and asked to see what other people think of them, but I guess the people here is free from this new damnation.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
I appreciate checker tools that also allow you to annotate the suspect region with "yes this is actually fine, do not warn" since you get the benefit of automated spot checks without just tuning then out altogether.

Presto
Nov 22, 2002

Keep calm and Harry on.

NihilCredo posted:

i can never take it seriously because of the name
See also: Cap'n Proto

Macichne Leainig
Jul 26, 2012

by VG

Presto posted:

See also: Cap'n Proto

I almost thought you were making fun of me for a second but then I Google'd it and... yup.

nielsm
Jun 1, 2009



SirViver posted:

I know basically nothing about modern C++ / template shenanigans and haven't worked with it since school (so ah... 20 years ago?), so I'm not even sure if this is introducing some subtle error/UDB, but one thing I still find a tiny bit confusing is:
C++ code:
// We want to ensure that +/- 0 is always represented as positive zero
if ( lhs == positive_zero ) { lhs = positive_zero; }
if ( rhs == positive_zero ) { rhs = positive_zero; }
Wouldn't this read slightly clearer like so:
C++ code:
// We want to ensure that +/- 0 is always represented as positive zero
if ( lhs == 0 ) { lhs = positive_zero; }
if ( rhs == 0 ) { rhs = positive_zero; }

Another option would be to dig fully into the floating point support library and write:
C++ code:
if (std::fpclassify(lhs) == FP_ZERO) { lhs = std::copysign(lhs, 1.0); }
Makes it clear that it's all about forcing the sign bit to false, and avoids a code structure that makes it look like you're assigning the value already stored.

spiritual bypass
Feb 19, 2008

Grimey Drawer

NihilCredo posted:

Does anybody remember the username of that weirdo who would open issues in GitHub C repos demanding that they fix some usually harmless warning or lint and then proceed to completely ignore responses or insist in the most obtuse manner, to the degree that some goons thought it was a bot?

https://github.com/elfring

fritz
Jul 26, 2003

nielsm posted:

If you wanted to use a keywords-only type that in most implementations end up as a 64 bit unsigned integer then unsigned long long would be the way to go.

I've been bit a few too many times by the same type being different sizes on different platforms to even think about using that instead of the explicit size.

Falcorum
Oct 21, 2010

NihilCredo posted:

Does anybody remember the username of that weirdo who would open issues in GitHub C repos demanding that they fix some usually harmless warning or lint and then proceed to completely ignore responses or insist in the most obtuse manner, to the degree that some goons thought it was a bot?

Odds are they're just padding their resume with "ACTIVE CONTRIBUTOR TO OPEN SOURCE PROJECTS".

As for Sonarcube, it's not completely terrible in terms of build integration, but it didn't really find anything for us other than a ton of false positives.

JawnV6
Jul 4, 2004

So hot ...

fritz posted:

I've been bit a few too many times by the same type being different sizes on different platforms to even think about using that instead of the explicit size.
that 'most' was doing some heavy lifting. there are a scant few places where I'd use something hoping to luck into a particular size.

Falcorum posted:

Odds are they're just padding their resume with "ACTIVE CONTRIBUTOR TO OPEN SOURCE PROJECTS".
lol no

repiv
Aug 13, 2009

Falcorum posted:

Odds are they're just padding their resume with "ACTIVE CONTRIBUTOR TO OPEN SOURCE PROJECTS".

wasn't there a guy who carpet bombed NPM with hundreds of trivial one-line packages then put on his resume that his code was used by all the top tech companies (because the big JS frameworks had a 50 level deep dependency on his package that checks if a number is odd or something)

Doom Mathematic
Sep 2, 2008

repiv posted:

wasn't there a guy who carpet bombed NPM with hundreds of trivial one-line packages then put on his resume that his code was used by all the top tech companies (because the big JS frameworks had a 50 level deep dependency on his package that checks if a number is odd or something)

Jon Schlinkert. His is probably the worst code I've ever read.

FlapYoJacks
Feb 12, 2009
Shits about to hit the fan. The main project just got my parasoft checks merged in. Any new warnings or rule violations are a hard error. I marked all pending pull requests as “needs work” to force all the developers to rebase against the develop branch. This is going to be so much fun. :allears:

Tomorrow I am flipping the switch of code coverage for unit tests as well.

FlapYoJacks
Feb 12, 2009
14 failed pipelines and counting. :allears:

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty
Someone just ran automation to submit 1000 PRs to add a line of config in 1000 repos. I'm not sure they thought about how badly this would completely overwhelm our terribly underprovisioned build system.

Oh well!

Woodsy Owl
Oct 27, 2004

YanniRotten posted:

Someone just ran automation to submit 1000 PRs to add a line of config in 1000 repos. I'm not sure they thought about how badly this would completely overwhelm our terribly underprovisioned build system.

Oh well!

1000 repos?

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty
Yeah it's sort of a fractal of horrors here, best not to look directly at it.

QuarkJets
Sep 8, 2008

When you realize that you require a kubernetes cluster just to run git submodule --init --recursive

QuarkJets fucked around with this message at 07:58 on Aug 4, 2021

Carbon dioxide
Oct 9, 2012

YanniRotten posted:

Someone just ran automation to submit 1000 PRs to add a line of config in 1000 repos. I'm not sure they thought about how badly this would completely overwhelm our terribly underprovisioned build system.

Oh well!

I guess they didn't add [skip-ci] to the commit message?
(This works for many - but not all - automated build systems.)

Woodsy Owl
Oct 27, 2004

YanniRotten posted:

Yeah it's sort of a fractal of horrors here, best not to look directly at it.

Is it a one-repo-per-customer-data-migration situation?

YanniRotten
Apr 3, 2010

We're so pretty,
oh so pretty

Woodsy Owl posted:

Is it a one-repo-per-customer-data-migration situation?

No! A large company that went nuts with microservices plus tons and tons of bespoke tooling and reporting systems.

Macichne Leainig
Jul 26, 2012

by VG
Now I’m no expert in microservices, but I think that’s kinda wrapped around to a completely different problem set at this point.

Now, tangentially related, if anyone has any good reading materials on microservices, I would be a very grateful goon.

csammis
Aug 26, 2003

Mental Institution
I’ve worked for a company that went into git submodules so hard that wouldn’t be unusual to have a superrepo with at least a couple hundred of them. None of them used semantic versioning, or a coherent feature / bug fix branching scheme, and you’d better believe there were interdependencies. Like DLL Hell all over again but it would take half a day to update submodules and get a good build going.

Adbot
ADBOT LOVES YOU

wilderthanmild
Jun 21, 2010

Posting shit




Grimey Drawer
I found a really lazy dumb hack today.

We had a place where some old angularJS code was supposed to be validating a date that was being stored as a string. Rather than like actually validating the string it just checked that it was 57 characters long.

For example:

Thu Aug 05 2021 12:20:23 GMT-0400 (Eastern Daylight Time)

The problem with this is obviously that other time zones exist, so that portion inside the parentheses changes length. So now that we're hiring remote workers outside of Central, Pacific, and Eastern timezones, which are all conveniently the same length, a bunch of forms that used this code are broken.

This also has the fun side effect that if a completely invalid string got into that field, it would be considered valid if it just happened to be 57 characters long.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply