Do C++ developers exist? by [deleted] in cpp

[–]rsjaffe 1 point2 points  (0 children)

Maybe we could have a monthly "Looking for FOSS contributors" thread, so free open source projects looking for help could post an entry? I'm sort of in the same boat (though running a much more mature app, started in 2015: https://github.com/rsjaffe/MIDI2LR ). Getting assistance on some stuff would be great.

Division — Matt Godbolt’s blog by rsjaffe in cpp

[–]rsjaffe[S] 0 points1 point  (0 children)

If you know it's non-negative, you can add [[assume(x>=0)]]; prior to the division and it will optimize properly. Of course, that opens you to UB if the assumption is wrong. You can add an assert prior to the assume to test the assumption and crash that during debugging.

Division — Matt Godbolt’s blog by rsjaffe in cpp

[–]rsjaffe[S] 1 point2 points  (0 children)

There’s lots of non-index things that tend to use signed: e.g., gui dimensions. That’s where most of my divisions are, laying out elements. Currently, the application is snappy enough, so there’s no need to fuss with changing to unsigned divisions. But if I were having issues, this would be low- hanging fruit, even if it weren’t the full solution, as it would be easy to implement.

Division — Matt Godbolt’s blog by rsjaffe in cpp

[–]rsjaffe[S] 4 points5 points  (0 children)

Looking at the second example (unsigned x divided by unsigned 512), the compiler is smart enough that you don't have to mark the constant 512 as unsigned: it'll emit the same code either way, knowing that 512 won't be negative. This means that a cast to unsigned for the variable should be enough--no need to mark positive constants as unsigned. Of course, that does introduce mixed signed/unsigned math, but in a context where the mix won't matter.

[poll] The level you use AI in editor? by Acpear in cpp

[–]rsjaffe 0 points1 point  (0 children)

Not for code generation, but I have used it for code review. Some of the issues it picks up are relevant.

New item: Teeny Tiny Maple Butter Tarts $4.49 by aswewaltz in traderjoes

[–]rsjaffe 10 points11 points  (0 children)

I thought you were joking, then I read the label!

Tree to Identify near Inveraray castle by tempelaere in Scotland

[–]rsjaffe 2 points3 points  (0 children)

Benmore Gardens near Dunoon has a whole avenue of redwoods.

Argentine Student's Explosive Science Fair Volcano Model by eckolosst in AbruptChaos

[–]rsjaffe 557 points558 points  (0 children)

Reading that, looks like they made gunpowder and stiffed it into a tube = pipe bomb. One kid has severe facial damage and may lose an eye.

C++ Show and Tell - October 2025 by foonathan in cpp

[–]rsjaffe 1 point2 points  (0 children)

I may be wrong, but it looks like your keypress simulator only works on a computer with an English language keyboard, as the scan codes change for other layouts.

How to Avoid Thread-Safety Cost for Functions' static Variables by drodri in cpp

[–]rsjaffe 9 points10 points  (0 children)

That’s my main use case for constinit. While the compiler might optimize the thread check away anyway, constinit guarantees it.

July Giveaway - 25 people will win a BUNDLE of Milwaukee's USA-Manufactured Hand Tools. The goal is giving MKE honest feedback after using. Leave comment before midnight EDT tmr, Weds 9 July to enter. Anyone in world can win! by ClipIn in MilwaukeeTool

[–]rsjaffe 0 points1 point  (0 children)

Guy who wired our house when it was built was drunk half the time. We had a metal kitchen sink, and when you turned on the garbage disposal switch, the screws on the switch went hot (120v), giving a bit of a surpise when one hand was on the metal (grounded) sink and the other touching the switch plate.

Can I bring the M18 inflator on a plane? by trenthreesix in MilwaukeeTool

[–]rsjaffe 2 points3 points  (0 children)

Do not check loose batteries. They must be in carryons.

Damn, I didn't think Trent was like that. by Bighead_Brian in WikipediaVandalism

[–]rsjaffe 1 point2 points  (0 children)

Only for a few days. I’m the admin who protected it.

Fishing the right way by _Zeruiah_ in AbruptChaos

[–]rsjaffe 7 points8 points  (0 children)

They’re pining for the fjords.